spacewander commented on a change in pull request #3839:
URL: https://github.com/apache/apisix/pull/3839#discussion_r597339059
##########
File path: apisix/plugins/cors.lua
##########
@@ -133,7 +157,7 @@ local function set_cors_headers(conf, ctx)
end
core.response.set_header("Access-Control-Allow-Origin",
ctx.cors_allow_origins)
- if ctx.cors_allow_origins ~= "*" then
+ if ctx.cors_allow_origins ~= "*" or conf.allow_origins_by_regex ~= nil then
Review comment:
I still don't understand why we need `or conf.allow_origins_by_regex ~=
nil`.
If `allow_origins_by_regex` is given but not matched, it can't go into this
function.
If `allow_origins_by_regex` is given but matched, the `cors_allow_origins`
can't be `*` as `*` is just a mark used in `allow_origins`.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]