How to use with Traefik reverse proxy #2655
-
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: 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. When manually changing the static URI; it works: 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 |
Beta Was this translation helpful? Give feedback.
Replies: 11 comments 1 reply
-
Did you also tried the http header way? what's your reverse proxy configuration? |
Beta Was this translation helpful? Give feedback.
-
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
<#2637 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABJEQYH6TQ77P6DHAOVHZALV53NMFANCNFSM6AAAAAAQJNAOTI>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
Beta Was this translation helpful? Give feedback.
-
Here is my Traefik configuration (reverse proxy)
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 |
Beta Was this translation helpful? Give feedback.
-
Could you set custom headers? You should add this header:
|
Beta Was this translation helpful? Give feedback.
-
Just commited a change to add |
Beta Was this translation helpful? Give feedback.
-
Hello, Just tried the header way with Traefik; here is the config:
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 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 |
Beta Was this translation helpful? Give feedback.
-
I encountered the same issues when I set up the service today and happened to see the commit mentioning this issue. The Using Traefik, you need two middlewares or one and the
|
Beta Was this translation helpful? Give feedback.
-
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
<#2637 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABJEQYHUCLEMN26AO7QE77DV6NQMJANCNFSM6AAAAAAQJNAOTI>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
Beta Was this translation helpful? Give feedback.
-
it worked with the @tjmv solution |
Beta Was this translation helpful? Give feedback.
-
This works, by getting the reverse proxy to strip off the base_path, but now the ui is only available via the reverse proxy, and not directly which is a shame. |
Beta Was this translation helpful? Give feedback.
-
Can somebody maybe post the complete final traefik config? I am still struggeling to make this work. Here is my config inside docker compose, I put everything inside the containers labels. ALli get with this is a blank page with the "Z-Wave JS UI" title and no error logs in neither zwavejs container nor traefik. I did not set the BASE_PATH variable
|
Beta Was this translation helpful? Give feedback.
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: