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 README.md for origin function callback parameters #180

Merged
merged 1 commit into from
Apr 20, 2020

Conversation

dstudzinski
Copy link
Contributor

@dstudzinski dstudzinski commented Sep 4, 2019

Updated README to better explain which types of parameters can be used for callback when origin is a function.

From what I checked callback's second parameter can be [bool|string] at least (I believe it support more types).

For example it can be used like this:

cors({
  'origin': function (origin, callback) {
    callback(null, origin || '*');
  },
})

To send * as origin when Origin headers is missing and value from Origin header when it's present.

@dougwilson
Copy link
Contributor

Thank you. The second argument is actually any value (except function) that the original origin can be set to.

@dougwilson dougwilson merged commit f91ec1d into expressjs:master Apr 20, 2020
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

2 participants