Skip to content

Commit

Permalink
docs: add note for rest tools / servers in dynamic origin example
Browse files Browse the repository at this point in the history
closes #142
  • Loading branch information
AbhishekBiswal authored and dougwilson committed Jun 22, 2018
1 parent b42b8b3 commit 2685e66
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions README.md
Expand Up @@ -115,6 +115,21 @@ app.listen(80, function () {
})
```

If you do not want to block REST tools or server-to-server requests,
add a `!origin` check in the origin function like so:

```javascript
var corsOptions = {
origin: function (origin, callback) {
if (whitelist.indexOf(origin) !== -1 || !origin) {
callback(null, true)
} else {
callback(new Error('Not allowed by CORS'))
}
}
}
```

### Enabling CORS Pre-Flight

Certain CORS requests are considered 'complex' and require an initial
Expand Down

0 comments on commit 2685e66

Please sign in to comment.