Open pa314159 opened 6 years ago
Hi @pa314159 ,
This is a good idea, and we should be able to easily add the bind address to the next release. As it relates to the base URL, do you envision something like http://127.0.0.1:15151/lxdui/...
or are you looking to have something along the lines of http://127.0.0.1/lxdui/...
which maps to http://127.0.0.1:15151/lxdui/...
behind the scenes?
So there are two threads here.
The first is the UI is rooted at the, unsurprisingly, ui
folder. Which is why you see the following url http://127.0.0.1:15151/ui/...
This could be updated/changed but for the time being we're gonna focus on delivering lots more features first.
The second is that URL/Port mapping can be addressed with a proxy like NGINX, which would be far more suitable for production anyway. It's far more preferable to have a more robust http proxy handle the request routing and port mapping because you get all the other freebies that nginx includes, like TLS/SSL.
Hi @vhajdari
Good news, I'm already runing lxdui behind a proxy so listening to 0.0.0.0 is not necessary...
Regarding the base URI, yes, I'd like to use something like /lxdui; it would be preferable to simply set it in LXDUI, and make LXDUI aware of such variable; it's true it could be handled by a proxy but that would increase the complexity of the proxy configuration.
Right now, my Apache contains
<Location /cont>
Require all granted
ProxyPass http://127.0.0.1:15151/ui/
ProxyPassReverse http://127.0.0.1:15151/ui/
AddOutputFilterByType SUBSTITUTE text/html
Substitute "s|=\"/ui/|=\"/cont/|i"
</Location>
... which is a bit too much for my taste :)
Even so, the configuration above doesn't solve anything because some URLs are built on the client side, in /app/ui/static/js/app.js
So I need to stick to /ui for now
One more thing, it looks like currently the base URI is / not /ui, as I also found there is an "/api" URI...
Therefore having a base URI like
lxdui.base = /some-location
the app should create URLs like
http://localhost:15151/some-location/api
http://localhost:15151/some-location/ui
Another way of defining the base URI would be (besides port and listening address)
lxdui.port = 12121
lxdui.bind = 127.0.0.1
lxdui.base = https://serverX.example.com/some-location
that could expose all links as
https://serverX.example.com/some-location/api
https://serverX.example.com/some-location/ui
This is what other apps (like Jenkins, Nexus-OSS) do when they are deployed behind a proxy
Any updates on this? I'd also like to see this - I only want LXDUI to listen on the server's VPN IP, not on the public IP for the server. I could firewall it off, but most server daemons have some option to specify the IP to bind to.
You can modify sources in ./app/api/controllers/terminal.py
There is a hardcoded string with http_server.listen(port, '0.0.0.0')
You can add here the interface you need.
Example diff:
diff --git a/app/api/controllers/terminal.py b/app/api/controllers/terminal.py
index dbec7aa..25314e3 100644
--- a/app/api/controllers/terminal.py
+++ b/app/api/controllers/terminal.py
@@ -68,5 +68,5 @@ def terminal(app, port, debug=False):
term_manager=term_manager,
debug=debug)
http_server = HTTPServer(tornado_app)
- http_server.listen(port, '0.0.0.0')
+ http_server.listen(port, '127.0.0.1')
@n0str , that doesn't solve the main problem which is defining an arbitrary base URI, e.g.
lxdui.base = /some-location
This would still be great to have. Especially since nginx doesn't really have the equivalent of ProxyPassReverse URI re-mapping that Apache has.
@mineibrm let's include host in config and Flask start with next release
It would be nice to be able to specify the listening address and the base URI, something like