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

Add httpAdminMiddleware for admin routes

This commit is contained in:
Nick O'Leary 2020-05-05 18:13:21 +01:00
parent 189389f96a
commit b0f9bf2c62
No known key found for this signature in database
GPG Key ID: 4F2157149161A6C9
2 changed files with 17 additions and 0 deletions

View File

@ -59,6 +59,12 @@ function init(settings,_server,storage,runtimeAPI) {
}); });
adminApp.use(corsHandler); adminApp.use(corsHandler);
if (settings.httpAdminMiddleware) {
if (typeof settings.httpAdminMiddleware === "function") {
adminApp.use(settings.httpAdminMiddleware)
}
}
auth.init(settings,storage); auth.init(settings,storage);
var maxApiRequestSize = settings.apiMaxLength || '5mb'; var maxApiRequestSize = settings.apiMaxLength || '5mb';

View File

@ -182,6 +182,17 @@ module.exports = {
// next(); // next();
//}, //},
// The following property can be used to add a custom middleware function
// in front of all admin http routes. For example, to set custom http
// headers
// httpAdminMiddleware: function(req,res,next) {
// // Set the X-Frame-Options header to limit where the editor
// // can be embedded
// //res.set('X-Frame-Options', 'sameorigin');
// next();
// },
// The following property can be used to pass custom options to the Express.js // The following property can be used to pass custom options to the Express.js
// server used by Node-RED. For a full list of available options, refer // server used by Node-RED. For a full list of available options, refer
// to http://expressjs.com/en/api.html#app.settings.table // to http://expressjs.com/en/api.html#app.settings.table