-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Allow RW auth to use capitalised authorization header #3829
Allow RW auth to use capitalised authorization header #3829
Conversation
Deploying to AWS (with serverless) seems to transform the authorization header to be captialised "Authorization". This causes the auth to fail. I found this from my own experience deploying this test project https://github.com/Irev-Dev/redwood-serverless-cors-demo Besides my own experience I tried to find docs confirming this, I found https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-known-issues.html Which says: "Header names and query parameters are processed in a case-sensitive way." and lists authorization with a capital "A", it doesn't explicitly say the header is transformed to uppercase, but I think it's implied. Besides AWS I think it somewhat likely that other deploy targets in the future might have the same quirk so this only seems to make the auth provider more robust.
For context I found this when looking into #3812. |
|'ve learned a little more since, This issue of the capitalised "Authorization" header only effects AWS's REST api, as opposed to the http api which doesn't have the same problem. The current serverless setup command uses the http-api, and that's recommended (it's newer and faster) so maybe this PR isn't needed, but it's possible a RW user would switch to the old api. |
@Irev-Dev it's a simple change that seem reasonable to me either way. Looping in @dthyresson for the offical go/no-go review. |
Deploying to AWS (with serverless) seems to transform the authorization header to be
captialised "Authorization".
This causes the auth to fail.
I found this from my own experience deploying this test project:
https://github.com/Irev-Dev/redwood-serverless-cors-demo
Which I was able to resolve with this change.
Besides my own experience I tried to find docs confirming this, I found
https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-known-issues.html
Which says:
"Header names and query parameters are processed in a case-sensitive way."
and lists authorization with a capital "A", it doesn't explicitly say
the header is transformed to uppercase, but I think it's implied.
Besides AWS, it's plausible that future deploy targets will have the same quirk, this change only makes the auth more robust.
Here's a screen shot from my Cloudwatch logs that show shows the "The

Authorization
header is not valid." error I was getting before the fix as well as the headers logged out showing the case of the authorization header.