-
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
let the path /apisix/admin support the CORS #982
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks good to me, but still need @membphis's check.
compare to make I think we can move those code into |
here is my suggestion for the admin api CORS feature. 1、set a enable_cors switch in config.yaml just like admin_port |
I think it is necessary to add a enable_admin_cors switch. |
@Miss-you Travis CI is broken. |
lua/apisix.lua
Outdated
@@ -446,6 +446,29 @@ function _M.http_balancer_phase() | |||
load_balancer(api_ctx.matched_route, api_ctx) | |||
end | |||
|
|||
local function cors_admin() | |||
local local_conf = core.config.local_conf() | |||
if local_conf.apisix or not local_conf.apisix.enable_admin_cors then |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
will be always true
, you should add test case for this PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I found this problem during my self-test, but forgot to submit the code
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
_M.init_worker() in lua/apisix/admin/init.lua also has the same problem.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
_M.init_worker() in lua/apisix/admin/init.lua also has the same problem.
welcome create another PR to fix it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok
1、set a enable_cors switch in config.yaml just like admin_port 2、move those CORS hardcode into function apisix.http_admin()
merged, thx @Miss-you |
…ORS.
NOTE: Please read the Contributing.md guidelines before submitting your patch:
https://github.com/apache/incubator-apisix/blob/master/Contributing.md#how-to-add-a-new-feature-or-change-an-existing-one
Summary
fix bin/apisix, let the API /apisix/admin support the CORS