lambda-api
lambda-api copied to clipboard
CORS Error due to lowercase
Firefox will not recognize cors headers due to them being lowercased:
https://github.com/jeremydaly/lambda-api/blob/0b753d855fd5be1f25b5291c78f25171d2151e19/lib/response.js#L68
Removing the "toLowerCase" fixes the issue.
Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://url.com/bla. (Reason: header ‘sentry-trace’ is not allowed according to header ‘Access-Control-Allow-Headers’ from CORS preflight response).
Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://url.com/bla. (Reason: CORS request did not succeed).
Added PR for this issue
Hi @Hobart2967. Lowercasing was done to be compatible with HTTP/2 and the change that Chrome made in version 60. See more here: https://github.com/elm/http/issues/31
I haven't looked into the status of the RFC or whether or not this has been reverted, but we can't just turn this off since it would break a number of existing applications. If you can share any updated research on this, then we can figure out a workaround that is backwards compatible.
Got ya, but on the other hand you're dropping browser support. Will adjust the PR to make it configurable
See here: https://github.com/jeremydaly/lambda-api/pull/169
I added a configuration entry headerStyle that applies the non-compliant header styles.