-
Notifications
You must be signed in to change notification settings - Fork 15
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
duplicate CORS headers leads to browser CORS errors #777
Comments
The problem may also occur with endpoint "/foo" {
request "r" {
url = "/bar"
backend = "be"
}
response {
headers = backend_responses.r.headers
}
} |
The CORS response headers must not be set/added before nextHandler.ServeHTTP(rw, req) in |
The desired effect is that the a-c-a-* headers generated by Couper's Ideally, we use the However, we might have the situation where the upstream sends more CORS headers than Couper would generate, e.g. max-age or allow-credentials. In this case we have to actively remove those headers to avoid mixed or unexpected CORS statements. |
Does the problem only occur with payload requests? The OPTIONS PFR is handled by Couper without actually executing the endpoint, isn't it? |
Yes |
We already set them. The problem is not to set it (in contrast to add), it's the right point in the process: The response headers must not be set prior to the
ACK |
Describe the bug
If you connect a backend api via proxy block and you have CORS options enabled and the api sends also such headers this leads to duplicate cors headers which the browser does not allow.
Current workaround is to add
remove_response_headers = ["access-control-allow-origin", "access-control-allow-credentials"]
to your backend definition.The text was updated successfully, but these errors were encountered: