Skip to content

fix: handle CORS preflight in reverse proxy during local dev#7164

Open
0xtlt wants to merge 1 commit intoShopify:mainfrom
0xtlt:fix/reverse-proxy-cors-headers
Open

fix: handle CORS preflight in reverse proxy during local dev#7164
0xtlt wants to merge 1 commit intoShopify:mainfrom
0xtlt:fix/reverse-proxy-cors-headers

Conversation

@0xtlt
Copy link
Copy Markdown

@0xtlt 0xtlt commented Apr 2, 2026

Summary

The HTTP reverse proxy used by shopify app dev does not handle CORS preflight (OPTIONS) requests, which breaks cross-origin fetch calls from UI extensions (e.g. Customer Account extensions calling the app backend through the Cloudflare tunnel).

This PR intercepts OPTIONS requests at the proxy level and responds with the appropriate CORS headers, reflecting the client's Origin, Access-Control-Request-Method and Access-Control-Request-Headers.

Changes

  • http-reverse-proxy.ts: intercept OPTIONS before forwarding, respond 204 with CORS headers
  • http-reverse-proxy.test.ts: 2 new tests (preflight with headers + preflight without)

Related: #5660

@0xtlt 0xtlt requested a review from a team as a code owner April 2, 2026 15:34
@0xtlt
Copy link
Copy Markdown
Author

0xtlt commented Apr 2, 2026

I have signed the CLA!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant