Is it possible to call an app proxy endpoint from an admin UI extension like we do from a Theme UI Extension?
I’m stuck with CORS errors.
I tried modifying entry.server.jsx file to accept the “OPTIONS” call for preflight before the “POST”, but then I get a 404 stating that the route doesn’t exits.
if (request.method == "OPTIONS") {
resolve(new Response('ok', { headers:
{
'Access-Control-Allow-Credentials': 'true',
'Access-Control-Allow-Origin': '*',
'Access-Control-Allow-Methods': 'OPTIONS,POST,GET',
'Access-Control-Allow-Headers': 'Content-Type,Authorization,User-Agent,Referer'
}
, status: 200 }));
}
I can’t figure out how to do this… I tried calling directly the app_proxy/endoint url but it is worst.
on the console I see “Error: Invalid request method “OPTIONS”” but it returns a 200 “ok” anyway and I see the POST is received after that but gets the 404.
Any idea ?