-
Notifications
You must be signed in to change notification settings - Fork 993
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(graphql): Fixes multiValueHeader handling (and CORS) in graphql handler #5970
Conversation
✅ Deploy Preview for redwoodjs-docs canceled.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks. Just minor word-smithing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! Awesome work. 🚀 I have no idea how you debugged this one but it looks like it must've been painful—saw some yarn patch action in the PR in deploy target CI so I can only guess haha
Blood, sweat and tears.... Half the effort was figuring out how to debug it! patch package comes in handy in these situations |
…o feat/ts-strictmode-gen * 'feat/ts-strictmode-gen' of github.com:dac09/redwood: (94 commits) fix(deps): update dependency @graphql-codegen/cli to v2.9.1 (redwoodjs#6013) Little grammar change (redwoodjs#6006) chore: connect repo to nx cloud to speed up builds (redwoodjs#5988) fix(deps): update dependency @testing-library/user-event to v14.3.0 (redwoodjs#6004) fix(deps): update graphqlcodegenerator monorepo (redwoodjs#6005) chore(deps): update dependency @auth0/auth0-spa-js to v1.22.2 (redwoodjs#6003) fix(graphql): Fixes multiValueHeader handling (and CORS) in graphql handler (redwoodjs#5970) chore(deps): update dependency @nhost/hasura-auth-js to v1.4.0 (redwoodjs#6001) chore(deps): update dependency @nhost/nhost-js to v1.4.7 (redwoodjs#5999) fix(deps): update dependency cross-undici-fetch to v0.4.14 (redwoodjs#6000) chore(deps): update dependency @azure/msal-browser to v2.28.0 (redwoodjs#5994) fix(deps): update dependency concurrently to v7.3.0 (redwoodjs#5995) chore(deps): update dependency @simplewebauthn/browser to v5.3.0 (redwoodjs#5989) chore(deps): update dependency @simplewebauthn/server to v5.3.0 (redwoodjs#5990) chore(deps): update dependency @simplewebauthn/typescript-types to v5.3.0 (redwoodjs#5991) fix(deps): update dependency @testing-library/user-event to v14.2.6 (redwoodjs#5992) fix(deps): update typescript-eslint monorepo to v5.30.7 (redwoodjs#5993) chore: clean up mock auth client (redwoodjs#5911) Adds Webauthn support (TouchID, FaceID) to dbAuth (redwoodjs#5680) chore(deps): update dependency octokit to v2.0.4 (redwoodjs#5986) ...
…andler (#5970) * Add some notes * fix(headers): Handle when multiValueHeaders are present, and also when they are not * Update comments Co-authored-by: David Thyresson <dthyresson@gmail.com>
…andler (#5970) * Add some notes * fix(headers): Handle when multiValueHeaders are present, and also when they are not * Update comments Co-authored-by: David Thyresson <dthyresson@gmail.com>
Fixes #5933
What does this do?
It fixes two different cases where we weren't returning CORS headers.
1. Netlify
Netlify supports
multiValueHeaders
- but still always returnedAccess-Control-Allow-Origin: null
. That's because in the way we had the logic, the headers in the request (yes, the request) were merged (headers + multiValueHeaders). So if you supply two origins to Yoga, it gets confused and returns null.This PR makes sure that we only use MVH .... OR ... Headers - not both in the construction of the request, before we pass it to yoga.
2.Vercel
Vercel does not support
multiValueHeaders
. So in this case, no CORS headers were returned at all. This PR changes it so that we return the headers for the response both as MVH and as regular headers.