Skip to content

Commit

Permalink
fix(CORS): use allow_origin config key instead of cors object
Browse files Browse the repository at this point in the history
  • Loading branch information
g-div committed Oct 6, 2017
1 parent eddf094 commit 3bd5aac
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
4 changes: 1 addition & 3 deletions config.tpl.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,5 @@
"admins": [],
"date_format": "MMMM DD, YYYY",
"port": 3000,
"cors": {
"whitelist": ["http://localhost:8080"]
}
"allow_origin": ["http://localhost:8080"]
}
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ function run(err, res) {

app.use(cors({
origin: (origin, callback) => {
if (typeof origin === 'undefined' || config.cors.whitelist.indexOf(origin) !== -1) {
if (typeof origin === 'undefined' || config.allow_origin.indexOf(origin) !== -1) {
callback(null, true);
} else {
callback(new Error('Not allowed by CORS'));
Expand Down

0 comments on commit 3bd5aac

Please sign in to comment.