Reverse proxy dynamic subpath #540
Reverse proxy dynamic subpath #540
Conversation
Feature: use ingress friendly ZWave To MQTT
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
I would like that @chrisns reviews this too before the merge |
Co-authored-by: Chris Nesbitt-Smith <chris@cns.me.uk>
Co-authored-by: Chris Nesbitt-Smith <chris@cns.me.uk>
Co-authored-by: Chris Nesbitt-Smith <chris@cns.me.uk>
I think it's a good idea. I have fixed the logo during development testing, added a more complete example of nginx configuration on a subpath -- it's the configuration I use to test working behind a reverse proxy. I have added a development dependency - proxyquire - that allows to test more static classes, like the I also added the proxy settings for webpack's webserver, this allows both hot reloading while using a running webserver. This is currently assuming that the server is running locally on port 8091. IE: you should be able to run Give it a try and let me know what you think. |
Grazie Fabio 😄 I will try it now give me a moment |
@fabio-torchetti When running |
|
please ignore ^^ comment see thlorenz/proxyquire#90 (comment) I'd only introduced rewire really to allow some instrumentation to be able to then write tests without changing the code, its a gross hack and can hopefully be removed at some point in the future. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just resolve conflicts then this can be merged @fabio-torchetti . Thanks ! 😃
@fabio-torchetti I saw your latest commit, if you use vscode you should have it auto running on save :) |
Co-authored-by: Chris Nesbitt-Smith <chris@cns.me.uk>
Co-authored-by: Chris Nesbitt-Smith <chris@cns.me.uk>
Co-authored-by: Chris Nesbitt-Smith <chris@cns.me.uk>
Co-authored-by: Chris Nesbitt-Smith <chris@cns.me.uk>
OK let's merge this. Thanks again @fabio-torchetti 🎉 |
thanks for bearing with us @fabio-torchetti that was a change required for what should have been way simpler |
What is it?
This is a PR to allow dynamic changing of the subpath the server is running behind. The idea is to allow the server to adapt to being behind a proxy that changes the root path.
How?
The main
index.html
page is rendered on the fly taking into consideration the path the page is being served from. This can be determined in two ways:1 - A
X-External-Path
header is passed along with the request2 - A
base
is specified in the application configurationThe api base and
socket.io
path is calculated based on the documentbaseURI
is set in theindex.html
base tag.Why?
I am planning to have ZWave To MQTT run behind the
ingress
of Home Assistant. I really didn't like the option to expose it directly under a new domain. So, in the spirit of the Open Source "If you don't like it, fix it!" this PR came to be.This related to #317