Documentation updates
As a follow up to https://github.com/MicrosoftDX/Vorlonjs/pull/403, I would like to suggest the following update:
There should be documentation for adding vorlon as a route on any server. It should look something like:
upstream vorlon {
server unix:/path/to/vorlon.socket;
}
...
server {
...
# Redirect /remote-debug to /remote-debug/ to stop it from showing ugly urls including port
location /remote-debug {
return 301 http://$host$uri/ ;
}
location /remote-debug/ {
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Frame-Options SAMEORIGIN;
proxy_set_header X-NginX-Proxy true;
proxy_set_header REMOTE_USER $remote_user;
# Needed for socket.io
proxy_http_version 1.1;
proxy_redirect off;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_pass http://vorlon;
}
}
Here you must also set baseURL in the config to /remote-debug. This allows for only one way to get to this route and is more secure. You can add in authentication here easily to log who is doing what. It would also be easy for change this config to split the dashboard into another route, etc.
I would also suggest moving the following line in vorlon.server.js to client side to remove the need for baseURL for certain things:
vorlonpluginfiles = vorlonpluginfiles.replace('"vorlon/plugins"', '"' + this.httpConfig.protocol + '://' + req.headers.host + baseUrl + '/vorlon/plugins"');
Firstly, this is a hack and makes figuring out what is changing loadingDirectory impossible via search. Secondly, this means I need to deal with baseURL and matching instead of simply getting it right because the client knows where its initial request is so everything should be relevant.
What do you think? Thanks again for this project, it makes debugging on mobile much better than the alternative options.
Good idea ! The documentation is open sourced here: https://github.com/MicrosoftDX/VorlonJSWeb can you do a PR? :)