Fix CORS credentials on app-dev reverse-proxy preflight - #8320
Open
trippyogi wants to merge 1 commit into
Open
Conversation
After Shopify#7164, app-dev answers OPTIONS itself and omitted Access-Control-Allow-Credentials, so credentialed cross-origin fetches failed. When Origin is present, include Allow-Credentials on the preflight response.
trippyogi
marked this pull request as ready for review
August 12, 2026 22:20
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
WHY are these changes introduced?
Fixes #8259
After #7164, the app-dev reverse proxy began answering CORS
OPTIONSitself instead of forwarding them to the backend. That synthetic 204 includedAccess-Control-Allow-Origin/ methods / headers, but notAccess-Control-Allow-Credentials. Credentialed cross-origin requests that require preflight therefore fail before reaching the backend.WHAT is this pull request doing?
When the preflight request has an
Origin, includeAccess-Control-Allow-Credentials: trueon the proxy's OPTIONS response (still reflecting the concrete origin, never pairing credentials with*).@shopify/appHow to test your changes?
pnpm --filter @shopify/app exec vitest run src/cli/utilities/app/http-reverse-proxy.test.tsExpect 12/12. The OPTIONS cases assert:
Origin→Access-Control-Allow-Credentials: trueOrigin→ credentials header absentOptional manual check: run
shopify app devwith a frontend request that actually triggers preflight (e.g.POST+Content-Type: application/json+credentials: include). On main the OPTIONS preflight fails CORS; on this branch it succeeds (backend must still send credentials CORS on the actual response).Checklist
patchfor bug fixes ·minorfor new features ·majorfor breaking changes) and added a changeset withpnpm changeset add