Closed jerome83136 closed 2 years ago
Did you also tried the http header way? what's your reverse proxy configuration?
Hello, No I didn't. I'm using Traefik as a reverse proxy so I have to figure out how to implement this method on it.
Do you think I should give up with the "path" method?
(I think the possibility to set the path thought a docker environment variable could help a lot of people implementing this easier 😉)
Le lun. 12 sept. 2022 à 09:44, Daniel Lando @.***> a écrit :
Did you also tried the http header way?
— Reply to this email directly, view it on GitHub https://github.com/zwave-js/zwavejs2mqtt/issues/2637#issuecomment-1243342027, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABJEQYH6TQ77P6DHAOVHZALV53NMFANCNFSM6AAAAAAQJNAOTI . You are receiving this because you authored the thread.Message ID: @.***>
Here is my Traefik configuration (reverse proxy)
accessLog: {}
log:
level: INFO
providers:
file:
filename: /etc/traefik/traefik.yml
watch: true
api:
dashboard: true
insecure: true
entryPoints:
web:
address: ":80"
http:
routers:
api:
rule: Host("domotique.maison.lan")
service: api@internal
##zwave2mqtt
zwave2mqtt:
rule: Host("domotique.maison.lan") && PathPrefix("/zwave/")
service: zwave2mqtt
priority: 1000
services:
zwave2mqtt:
loadBalancer:
servers:
- url: "http://192.168.1.253:8091"
But I don't think it will be usefull here as the path is not working by connecting directly to the zwave2mqtt docker instance (http://[IP]:8091/zwave)
I think the static pages are not inheriting the "path" configuration. What do you think ?
Best regards
Could you set custom headers? You should add this header:
X-External-Path /zwave;
Just commited a change to add BASE_PATH
env var
Hello,
Just tried the header way with Traefik; here is the config:
http:
routers:
##zwave2mqtt
zwave2mqtt:
rule: Host("domotique.maison.lan") && PathPrefix("/zwave/")
service: zwave2mqtt
priority: 1000
middlewares:
- zwave2mqtt
middlewares:
zwave2mqtt:
headers:
customRequestHeaders:
X-External-Path: "/zwave"
customResponseHeaders:
X-External-Path: "/zwave"
services:
zwave2mqtt:
loadBalancer:
servers:
- url: "http://ZWAVE2MQTTIP:8091"
Sadly, it still doesn't work.
The "X-External-Path" header is set with the value "/zwave" and when reaching zwavemqtt trought the reverse proxy; the "root" page is accesible with the "/zwave" URI The static pages inherited the "/zwave" URI; but they are still unreachable (404)
This is the same behaviour than with the "path" config option.
Will try with the "BASE_PATH" environment variable when it is released.
Best regards
I encountered the same issues when I set up the service today and happened to see the commit mentioning this issue. The BASE_PATH
environment variable alone is not enough and has the same effect as the header: This adds the prefix, but the server is not aware of it and expects everything to be served from the root. However, you can work around it by first adding the path in the application and then strip it in the proxy.
Using Traefik, you need two middlewares or one and the BASE_PATH
variable to get it working right now:
zwave2mqtt-inject-basepath:
headers:
customRequestHeaders:
X-External-Path: "/zwave/"
zwave2mqtt-strip-basepath:
stripprefix:
prefixes: "/zwave"
Oh, great tip Will try it asap Thank you !
Le jeu. 15 sept. 2022 à 20:04, tjmv @.***> a écrit :
I encountered the same issues when I set up the service today and happened to see the commit mentioning this issue. The BASE_PATH environment variable alone is not enough and has the same effect as the header: This adds the prefix, but the server is not aware of it and expects everything to be served from the root. However, you can work around it by first adding the path in the application and then strip it in the proxy.
Using Traefik, you need two middlewares or one and the BASE_PATH variable to get it working right now:
zwave2mqtt-inject-basepath: headers: customRequestHeaders: X-External-Path: "/zwave/" zwave2mqtt-strip-basepath: stripprefix: prefixes: "/zwave"
— Reply to this email directly, view it on GitHub https://github.com/zwave-js/zwavejs2mqtt/issues/2637#issuecomment-1248431754, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABJEQYHUCLEMN26AO7QE77DV6NQMJANCNFSM6AAAAAAQJNAOTI . You are receiving this because you authored the thread.Message ID: @.***>
it worked with the @tjmv solution Thanks ! Regards
Hello,
I just pulled the latest docker image and I'm unable to configure the "base path" of the application in order to use it behind a reverse proxy.
I modified this file: config/app.js and changed this:
exports.base = '/zwave/';
Then restarted the docker.
Then trying to access the app: http://[IP]:8091/zwave
I get these URI generated on these HTTP status code on my browser:
It seems the config works because URIs are generated with "/zwave"; but static elements are not reachable on the new path. Did I miss something ?
When manually changing the static URI; it works:
http://[IP]:8091/static/css/app.e7f63f8bf06c7dd2f2ba.css --> HTTP/200
I was also unable to apply the documented procedure here: https://zwave-js.github.io/zwavejs2mqtt/#/usage/reverse-proxy?id=using-the-configuration
Thank you for your help Best regards