Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow * in array of origin #204

Closed
wants to merge 1 commit into from
Closed

Allow * in array of origin #204

wants to merge 1 commit into from

Conversation

RealPeha
Copy link

I added origin via env variable like so:

app.enableCors({
    origin: configService.get<string>('CORS_ORIGIN')!.split(','),
});

This allowed you to specify multiple domains separated by commas
But I didn’t understand why it didn’t work if I wrote CORS_ORIGIN: *

After looking at the source code i saw that there is no check for * in the array of origins

So I think that no matter if I write like this * or so [*] the result should be the same

@dougwilson
Copy link
Contributor

Thank you. We likely need to wait to land this until we are spinning up a new major version of this module. See #185


it('should allow origin if array include *', function (done) {
var options = {
origin: ['*']

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think that origin: ['*'] should mean reflect back the requesting origin when origin: '*' means send a header of Access-Control-Allow-Origin: *. I have some more thoughts here.

@dougwilson
Copy link
Contributor

I'm closing this for now due to the great issues @douglasnaphas raised in #185 (comment)

@dougwilson dougwilson closed this Aug 22, 2020
@RealPeha RealPeha deleted the fix/allow-origin branch October 2, 2020 14:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants