miaoyb opened a new issue #3759: URL: https://github.com/apache/apisix/issues/3759
### Issue description cors plugins support domain limit ### Environment * apisix version (cmd: `apisix version`): v2.3 * OS (cmd: `uname -a`): * OpenResty / Nginx version (cmd: `nginx -V` or `openresty -V`): * etcd version, if have (cmd: run `curl http://127.0.0.1:9090/v1/server_info` to get the info from server-info API): * apisix-dashboard version, if have: ### Support Action `diff --git a/apisix/plugins/cors.lua b/apisix/plugins/cors.lua index fc90dc18..360aee77 100644 --- a/apisix/plugins/cors.lua +++ b/apisix/plugins/cors.lua @@ -74,6 +74,12 @@ local schema = { type = "boolean", default = false } + domamin_limit = { + description = + "设置允许跨域的域名", + type = "str", + default = "([^,]+)" + }, } } @@ -90,7 +96,7 @@ local function create_multiple_origin_cache(conf) return nil end local origin_cache = {} - local iterator, err = re_gmatch(conf.allow_origins, "([^,]+)", "jiox") + local iterator, err = re_gmatch(conf.allow_origins, conf.domamin_limit, "jiox") if not iterator then core.log.error("match origins failed: ", err) return nil (END)` ---------------------------------------------------------------- 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]
