How to add specific urls to cors? #2723
Unanswered
CristobalSoto
asked this question in
Q&A
Replies: 1 comment 2 replies
-
|
If permitting more than one origin in your CORS configuration, your middleware options should look like this example: https://www.npmjs.com/package/cors#configuring-cors-w-dynamic-origin set up an array with the specific origins you are permitting: var whitelist = ['http://example1.com', 'http://example2.com']
var corsOptions = {
origin: function (origin, callback) {
if (whitelist.indexOf(origin) !== -1) {
callback(null, true)
} else {
callback(new Error('Not allowed by CORS'))
}
}
}The reason you don't want to pair |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I need to login from a different app, Im using cors middleware to be able to access the blitz app endpoints but when I put the credentials 'include' I get the error that the Access-Control-Allow-Origin header should not be with wildcard (*), I suppose that is what is set when I add the cors middleware so what is the best way to do this because if I use the cors middleware I cant use the credencials include apparently....
Beta Was this translation helpful? Give feedback.
All reactions