Ok that seems to work, I just tested this on my localhost installation, in settings.js I did this:
httpAdminRoot: '/cfg',
httpAdminMiddleware: [
(req,res,next) => {
if ( req.host == "127.0.0.1" ) {
next();
} else {
res.status(404).send("Not Found - " + req.host );
}
}
],
/*** somewhere further down ***/
ui: {
path: "/",
middleware: [
(req, res, next) => {
if ( req.hostname == "localhost" ) {
next();
} else {
res.status(404).send("Not Found - " + req.hostname );
}
}
],
ioMiddleware: [
/* need to do the same for the socket */
]
},
This meant that I had the following:
http://localhost/cfg --> flow editor
http://127.0.0.1/cfg --> 404 Not Found
http://localhost/ --> 404 Not Found
http://127.0.0.1/ --> Dashboard
The next step would be to try this out at Heroku and check whether the domain (and which header with domain) is passed through to the Node-RED endpoint.