CORS allow multiple domains #8516
Labels
state:released
Released as stable version
state:released-alpha
Released as alpha version
state:released-beta
Released as beta version
type:feature
New feature or improvement of existing feature
New Feature / Enhancement Checklist
Current Limitation
The current configuration seems to only support one origin or ALL origins (*)
Feature / Enhancement Description
Modify the middlewares' allowCrossDomain function to support comma delimited
ALLOW_ORIGIN
, look for a matching origin to the request's origin header and set the response header to the match, otherwise just set the header to the first value in the list of allowed originsExample Use Case
Then, webapps at
a.com
,b.com
, andc.com
will not have CORS issues sending requests, butd.com
will not be allowed.Alternatives / Workarounds
Setting to * (or leaving undefined), allows any origin, but this has security implications.
3rd Party References
https://github.com/expressjs/cors
Notes
I have a patch which I've been using. I'll make a PR soon
The text was updated successfully, but these errors were encountered: