Skip to content

Commit

Permalink
CORS not properly configured on multiple http routes
Browse files Browse the repository at this point in the history
  • Loading branch information
knolleary committed Jan 13, 2016
1 parent 6dc640b commit 6e75089
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions nodes/core/io/21-httpin.js
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,13 @@ module.exports = function(RED) {
return wrapper;
}

var corsHandler = function(req,res,next) { next(); }

if (RED.settings.httpNodeCors) {
corsHandler = cors(RED.settings.httpNodeCors);
RED.httpNode.options("*",corsHandler);
}

function HTTPIn(n) {
RED.nodes.createNode(this,n);
if (RED.settings.httpNodeRoot !== false) {
Expand Down Expand Up @@ -185,14 +192,6 @@ module.exports = function(RED) {
}
};

var corsHandler = function(req,res,next) { next(); }

if (RED.settings.httpNodeCors && !corsSetup) {
corsHandler = cors(RED.settings.httpNodeCors);
RED.httpNode.options("*",corsHandler);
corsSetup = true;
}

var httpMiddleware = function(req,res,next) { next(); }

if (RED.settings.httpNodeMiddleware) {
Expand Down

0 comments on commit 6e75089

Please sign in to comment.