Drewolf commented on issue #8399: URL: https://github.com/apache/apisix/issues/8399#issuecomment-1327021630
> I try it on my local env. I know what happened. This is because the cors plugin will match `allow_origins` first, if `allow_origins` does not match then it will try to match it with regex using `allow_origins_by_regex`. > > Therefore when `allow_origins` set as `*`, any URL will matched, so that `allow_origins_by_regex` will not match again. > > So, the right config is below. You can change `http://example.com` to any URL you are NOT using like `http://baidu.com` or `http://xxx.com`. Just make `allow_origins` not match. > > ```json > { > "allow_credential": false, > "allow_headers": "*", > "allow_methods": "*", > "allow_origins": "http://example.com", > "allow_origins_by_regex": [ > ".*\\.test\\.com", > "test\\.com" > ], > "expose_headers": "*", > "max_age": 5 > } > ``` > > or > > ```json > { > "allow_credential": false, > "allow_headers": "*", > "allow_methods": "*", > "allow_origins": "http://test.com", > "allow_origins_by_regex": [], > "expose_headers": "*", > "max_age": 5 > } > ``` 这样是正常的吗?response中没有任何跨域相关的 header   -- 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. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
