How can I call an app proxy endpoint from an admin UI extension?

Topic summary

A developer is attempting to call an app proxy endpoint from a Shopify admin UI extension but encounters CORS (Cross-Origin Resource Sharing) errors.

Attempted Solutions:

  • Modified entry.server.jsx to handle OPTIONS preflight requests before POST requests
  • Added CORS headers including Access-Control-Allow-Origin, Access-Control-Allow-Methods, and Access-Control-Allow-Headers
  • Tried calling the app proxy endpoint URL directly

Current Issues:

  • The OPTIONS request returns a 200 “ok” response, but subsequent POST requests result in 404 errors indicating the route doesn’t exist
  • Console shows “Invalid request method ‘OPTIONS’” error
  • The approach that works for Theme UI Extensions doesn’t translate to admin UI extensions

Status: The issue remains unresolved, with the developer seeking guidance on the correct method to call app proxy endpoints from admin UI extensions.

Summarized with AI on November 12. AI used: claude-sonnet-4-5-20250929.

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 ?