mscb402 commented on issue #8399:
URL: https://github.com/apache/apisix/issues/8399#issuecomment-1326987304

   I try it on my local env. I know what happened. This is because cors plugin 
will match 'allow_origins' first, if 'allow_origins' not match then it will try 
match it with regex using 'allow_origins_by_regex'.
   
   So, right config is
   ```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
       }
   ```
   
   


-- 
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]

Reply via email to