-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
bug: cors should be at header_filter phase #1915
Comments
@ShiningRush do you have time to look at this issue? |
@JanLi-air many thx for your report this bug |
It related with #1704, I will fix it in this week. |
if cors plugin needs to work with auth plugins, i think we can set header both at header_filter phase and after auth failure. |
Yes, you are right : ) |
it depends on how we write the header. because in http you can have multiple headers with identical name, so if you want to override you need to first delete the existing one. |
Issue description
the cors headers can be overridden by upstreams if it's put at rewrite phase.
Environment
apisix version
): 1.4Minimal test code / Steps to reproduce the issue
What's the actual result? (including assertion message & call stack if applicable)
the cors header will be determined by the upstream
What's the expected result?
the cors header should be determined by the cors plugin.
This is related to antoher issue: #1528
I don't think it's good practice to change the phase of cors plugin to make sure it works with the auth plugins.
The cors plugin worked in header_filter phase since it needs to rewrite those headers after apisix gets response from upstream. If we change it to be at the rewrite phase, it's possible the header got overridden by upstream or the header is discarded somewhere.
The text was updated successfully, but these errors were encountered: