1
0
mirror of https://github.com/node-red/node-red.git synced 2023-10-10 13:36:53 +02:00

Option to enable cors for editor (#886)

Adds httpAdminCors setting
This commit is contained in:
Trisooma 2016-05-31 15:55:03 +02:00 committed by Nick O'Leary
parent 3454e5ac77
commit f1ce0fab8b

View File

@ -20,6 +20,7 @@ var util = require('util');
var path = require('path'); var path = require('path');
var passport = require('passport'); var passport = require('passport');
var when = require('when'); var when = require('when');
var cors = require('cors');
var ui = require("./ui"); var ui = require("./ui");
var nodes = require("./nodes"); var nodes = require("./nodes");
@ -112,6 +113,10 @@ function init(_server,_runtime) {
); );
adminApp.post("/auth/revoke",needsPermission(""),auth.revoke,errorHandler); adminApp.post("/auth/revoke",needsPermission(""),auth.revoke,errorHandler);
} }
if (settings.httpAdminCors) {
var corsHandler = cors(settings.httpAdminCors);
adminApp.use(corsHandler);
}
// Flows // Flows
adminApp.get("/flows",needsPermission("flows.read"),flows.get,errorHandler); adminApp.get("/flows",needsPermission("flows.read"),flows.get,errorHandler);