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

Update index.js #124

Closed
wants to merge 1 commit into from
Closed

Update index.js #124

wants to merge 1 commit into from

Conversation

desmati
Copy link

@desmati desmati commented Aug 10, 2017

sending the entire request in originCallback helps to check headers in CustomOrigin function. authorization for example.

sending the entire request in originCallback helps to check headers in CustomOrigin function. authorization for example.
@dougwilson
Copy link
Contributor

Hi @desmati only the origin is provided because, per spec, you're only allowed to make the decision based on the Origin header for CORS. If you would like to implement custom logic based on any aspect of the request, you should configure CORS with a function (https://github.com/expressjs/cors#configuring-cors-asynchronously) and then have that function, based on your logic, return an object that defines what the CORS rules are for the request you're given.

Without knowing the specifics of your use-case I'm not able to draw up example code to help you, but if you wanted to provide exactly what you're trying to do, I can take a stab.

@dougwilson dougwilson closed this Aug 10, 2017
@dougwilson dougwilson added the pr label Aug 10, 2017
@dougwilson dougwilson self-assigned this Aug 10, 2017
@dougwilson dougwilson mentioned this pull request Aug 10, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants