Domoticz behind Nginx reverse proxy

Topics (not sure which fora)
when not sure where to post, post here and mods will move it to right forum.

Moderators: leecollings, remb0

Post Reply
gwabber
Posts: 20
Joined: Saturday 02 September 2017 14:32
Target OS: Linux
Domoticz version: 3.8153
Location: Netherlands
Contact:

Domoticz behind Nginx reverse proxy

Post by gwabber »

Hi all,

I placed my Domoticz installation behind an Nginx revers proxy to create secure connections with SSL. All is working well, except the powermonitor.

When I access my Domoticz webpage via the proxy, the Powermonitor doesnt show reallife information, but I have to refresh the page manually.
If i access Domoticz via the internal IP, all is working well.

Could someone help me with this?

Thanks in advance!
VMWare ESXI, Ubuntu 20.04. Zwave and RFXCom
User avatar
waltervl
Posts: 5148
Joined: Monday 28 January 2019 18:48
Target OS: Linux
Domoticz version: 2024.7
Location: NL
Contact:

Re: Domoticz behind Nginx reverse proxy

Post by waltervl »

Did you see the last note on the following Wiki page?
https://www.domoticz.com/wiki/WebServer_Proxy
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
gwabber
Posts: 20
Joined: Saturday 02 September 2017 14:32
Target OS: Linux
Domoticz version: 3.8153
Location: Netherlands
Contact:

Re: Domoticz behind Nginx reverse proxy

Post by gwabber »

Thanks for your reply!

Yes, i have done that!

I am using the Nginx proxymanager, maybe there is a problem?
VMWare ESXI, Ubuntu 20.04. Zwave and RFXCom
User avatar
waltervl
Posts: 5148
Joined: Monday 28 January 2019 18:48
Target OS: Linux
Domoticz version: 2024.7
Location: NL
Contact:

Re: Domoticz behind Nginx reverse proxy

Post by waltervl »

What do you mean with "the Powermonitor doesnt show reallife information"?

I do not know a Powermonitor page/device. I know the Utility page where all the Utility devices are listed.
Are the devices on other pages like temperature and weather updating correctly?
If you press F12 (inspect) in the browser with the "Powermonitor" webpage do you see errors in the console?
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
gwabber
Posts: 20
Joined: Saturday 02 September 2017 14:32
Target OS: Linux
Domoticz version: 3.8153
Location: Netherlands
Contact:

Re: Domoticz behind Nginx reverse proxy

Post by gwabber »

Goodevening!

I indeed mean the utilities page. They show the correct information, but I have to manually refresh the page to update the information. This goes for all pages.

I'll check the error console!

Update: It says a websocket connection has failed.
VMWare ESXI, Ubuntu 20.04. Zwave and RFXCom
User avatar
waltervl
Posts: 5148
Joined: Monday 28 January 2019 18:48
Target OS: Linux
Domoticz version: 2024.7
Location: NL
Contact:

Re: Domoticz behind Nginx reverse proxy

Post by waltervl »

Can you clear your browser cache? See wiki for instructions for your browser.
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
gwabber
Posts: 20
Joined: Saturday 02 September 2017 14:32
Target OS: Linux
Domoticz version: 3.8153
Location: Netherlands
Contact:

Re: Domoticz behind Nginx reverse proxy

Post by gwabber »

Your tip did the trick! I just needed to enable websockets. Thanks for your help!
VMWare ESXI, Ubuntu 20.04. Zwave and RFXCom
majki
Posts: 21
Joined: Monday 19 July 2021 14:59
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Krakow, PL
Contact:

Re: Domoticz behind Nginx reverse proxy

Post by majki »

Hi @gwabber.

I have also domoticz behind reverse proxy and I'm getting wss errors in my web browser:

Code: Select all

WebSocket connection to 'wss://domoticz.mydomain/json' failed: 
NPM log:

Code: Select all

[07/Jun/2022:12:47:26 +0000] - 400 400 - GET https domoticz.mydomain "/json" [Client 12.34.56.78] [Length 89] [Gzip -] [Sent-to 192.168.0.154] "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/...
Can you explain how did you manage this to work? Which config file I need to modify? How did you "enabled the websockets"? Am I using APACHE proxy or NGINX proxy? I'm totally lost now :?

I'm using NGINX proxy manager and Cloudflare. Both NPM and domoticz are in docker containers.
I have also tried to modify NPM host config, but without luck.

FYI: Domoticz page is loading OK, but these websocket errors are causing error 400 (bad request) constantly and my fail2ban is banning me all the times :lol:
gwabber
Posts: 20
Joined: Saturday 02 September 2017 14:32
Target OS: Linux
Domoticz version: 3.8153
Location: Netherlands
Contact:

Re: Domoticz behind Nginx reverse proxy

Post by gwabber »

Hey @majki,

I wish I could help you, but I use the Nginx reverse proxymanager webinterface and I just turned websockets on in the settings menu:
Attachments
websockets.PNG
websockets.PNG (16.87 KiB) Viewed 1276 times
VMWare ESXI, Ubuntu 20.04. Zwave and RFXCom
Post Reply

Who is online

Users browsing this forum: Google [Bot] and 1 guest