-
-
Notifications
You must be signed in to change notification settings - Fork 3k
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/Expose-Headers headers overwrite user-provided ones #5892
Comments
No, this is a bug. I'm trying to fix it now. Ironically, preflight requests still work (as far as I can tell) because we only override these headers in HEAD/GET, not in OPTIONS (where they're actually useful). |
This is a complete mess. We have different code for the gateway and the API and the API doesn't use the CORs library. I'm not even sure where we should start untangling this mess. |
fixes #5138 -- always add user-agent to access-control-allow-headers. fixes #5888 -- same with content-type. fixes #5892 -- extend user-provided headers instead of overriding them. License: MIT Signed-off-by: Steven Allen <[email protected]>
fixes #5138 -- always add user-agent to access-control-allow-headers. fixes #5888 -- same with content-type. fixes #5892 -- extend user-provided headers instead of overriding them. License: MIT Signed-off-by: Steven Allen <[email protected]>
I think we should be smart when it comes to CORS and return headers only when they are actually meaningful for specific request type – wrote some notes in #5893 (review) |
Version information: master
Type: bug?
Description:
Per https://github.com/ipfs/go-ipfs/blob/master/core/corehttp/gateway_handler.go#L197 we set
Access-Control-Allow-Headers
andAccess-Control-Expose-Headers
AFTERi.addUserHeaders(w)
.Per https://github.com/ipfs/go-ipfs/blob/master/docs/config.md#gateway the users are told that they can customize these headers.
Per https://github.com/ipfs/go-ipfs-config/blob/e6bdf3c437bc6820f8d7e0cb337bf4b900fd1f1b/init.go#L67 the default configuration sets
Access-Control-Allow-Headers
, but whatever the user puts here they are overwritten (?).Am I missing something or should
i.addUserHeaders(w)
happen afterwards setting the defaults?cc. @lidel
The text was updated successfully, but these errors were encountered: