Skip to content

Commit

Permalink
fix: cors does not like wildcards
Browse files Browse the repository at this point in the history
  • Loading branch information
Ahmad Nassri committed Mar 18, 2015
1 parent 65fe296 commit ca62fe0
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions src/middleware/cors.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ module.exports = function (req, res, next) {
methods: req.method
}

console.log(req.headers)

if (req.headers.origin) {
cors.origin = req.headers.origin
}
Expand All @@ -20,11 +22,6 @@ module.exports = function (req, res, next) {
cors.methods = req.headers['access-control-request-method']
}

if (req.method === 'OPTIONS') {
cors.headers = '*'
cors.methods = '*'
}

res.set({
'Access-Control-Allow-Origin': cors.origin,
'Access-Control-Allow-Methods': cors.methods,
Expand Down

0 comments on commit ca62fe0

Please sign in to comment.