-
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
help request: CORS plugin not working properly in Consumer
#7072
Comments
Should be solved by this PR: #6502 Please verify with the latest version(v2.13.0 or the master branch). |
I have tested in 2.13.1, when the CORS plugin is configured in Consumer,
|
2.13.1 should take this fix with it. Please describe the reproduce the steps, I need to recover them. |
I confirmed that the source code of
In addition, I will test the CORS plugin again. If there are still problems, I will submit the detailed steps.
|
|
Description
When I try to use the CORS plugin in
Consumer
, I get an unexpected response header.So I analyzed the source code and tried to call
core.request.header(ctx, "Origin")
in_M.header_filter
, and finally CORS worked normally.I speculated and confirmed that
_M.rewrite()
cannot be called inConsumer
, but starting from 2.12.1,APISIX
has modified its practice to get thein the request header in
_M.rewrite()Origin
parameter, is this in line with the original intention of your design?当我尝试在
Consumer
中使用CORS插件时,我获得了一个预期外的响应头。于是我分析了源码,并尝试在
_M.header_filter
中调用core.request.header(ctx,"Origin")
,最终CORS正常的工作了。我推测并印证了
_M.rewrite()
无法在Consumer
中被调用,但是从2.12.1开始,APISIX
修改了做法,在_M.rewrite()
中获取请求头中的Origin
参数,请问这是符合你们的设计初衷的么?Environment
apisix version
):2.12.1uname -a
):Linux apisix-server-cd8564555-2njxg 3.10.0-514.26.2.el7.x86_64 change: added doc of how to load plugin. #1 SMP Tue Jul 4 15:04:05 UTC 2017 x86_64 x86_64 x86_64 GNU/Linuxopenresty -V
ornginx -V
):openresty/1.19.9.1curl http://127.0.0.1:9090/v1/server_info
):luarocks --version
):The text was updated successfully, but these errors were encountered: