ipm
ipm copied to clipboard
Unable to run IPM on domain path
I setting up my own cluster of nodes and would like to run IPM on a subpath of my domain:
https://dashboards.example.com/node-00-dashboard/
This is currently not possible with the current implementation.
The ask is to all a user-configurable access path., i.e.
node index.js -i http://node00.pool.example.com:14265 -p 127.0.0.1:14400/node-00-dashboard -r 10
This would require something along the lines of
var port = 8888;
var host = "127.0.0.1";
+var path = "/";
if (typeof argv.port === 'string'){
- var portArgs = argv.port.split(':');
+ var pathArgs = argv.port.split('/');
+ path = pathArgs[1];
+ var portArgs = pathArgs[0].split(':');
port = portArgs[1];
- host = portArgs[0];
+ host = portArgs[0];
}
else if (argv.port){
port = argv.port;
}
-console.log("Serving IOTA peer dashboard at http://"+host+":"+port);
+console.log("Serving IOTA peer dashboard at http://"+host+":"+port+'/'+path);
+
+app.use('/'+path,express.static(__dirname+'/public'));
I have made these change to index.js and conceptually it will work, but will need a lot more work on the interface side to work with dynamic pathing.
Just try a reverse proxy with basic auth. With this option you can use every path and have authentication before your IPM. Attached you can find an example with nginx on the "root" path
location / {
auth_basic "Restricted";
auth_basic_user_file /path/to/basicauth/file;
proxy_pass http://127.0.0.1:11111;
proxy_redirect default;
access_log /var/log/nginx/iota_access.log;
error_log /var/log/nginx/iota_error.log;
}
And this I can do in apache too without issue :) What I would like to do is not run it at root, but at /dashboard
, I would like to server a different page on the root path.
Works with proxy: https://www.example.com Does not work with Proxy: https://www.example.com/dashboard
This is because all references to resources in the project expect the application to be running on the root directory. The dashboard will sorta load, but fails with many missing dependencies, and the DOM still references things at root.
Thats right... In that case you can create a subdomain for every node.
management.node01.com management.node02.com
Is this way possible to you? I think this is a much better solution, but this is my personal opinion.
You don't say... I know how to configure subdomains. The ask is to add support to be able to run it on a path. If you are unable to help, please refrain from commenting.
This is a bit complicated because you will need to take care of socket.io dependencies as well and this needs to be injected into the static scripts which are served by express.static() Will welcome any pull request for this.