Closed Matthbo closed 5 years ago
You need to properly instruct the yaml parser you are providing a regepx and not a simple string
- - {cors: [{action: {origin: ['https://example.com', /https:\/\/w*\.example.com$]}}]}
+ - {cors: [{action: {origin: ['https://example.com', !!js/regexp /https:\/\/w*\.example.com$]}}]}
I have made an example gateway.config.yml:
When I try to fetch from
https://www.example.com
it should return without having a CORS problem, however it seems like theAccess-Control-Allow-Origin
isn't sent.It does work if I change
origin: ['https://example.com', /https:\/\/w*\.example.com$]
toorigin: ['https://example.com', 'https://www.example.com']
.The fault isn't the RegExp, I checked it here and it seems to work just fine. This would mean that while stated in the docs
origin
doesn't check for RegExp.