Page 1 of 1

Domoticz behind Nginx reverse proxy

Posted: Sunday 13 March 2022 10:44
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!

Re: Domoticz behind Nginx reverse proxy

Posted: Sunday 13 March 2022 17:23
by waltervl
Did you see the last note on the following Wiki page?
https://www.domoticz.com/wiki/WebServer_Proxy

Re: Domoticz behind Nginx reverse proxy

Posted: Sunday 13 March 2022 21:53
by gwabber
Thanks for your reply!

Yes, i have done that!

I am using the Nginx proxymanager, maybe there is a problem?

Re: Domoticz behind Nginx reverse proxy

Posted: Monday 14 March 2022 9:07
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?

Re: Domoticz behind Nginx reverse proxy

Posted: Monday 14 March 2022 21:09
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.

Re: Domoticz behind Nginx reverse proxy

Posted: Monday 14 March 2022 21:21
by waltervl
Can you clear your browser cache? See wiki for instructions for your browser.

Re: Domoticz behind Nginx reverse proxy

Posted: Monday 14 March 2022 21:36
by gwabber
Your tip did the trick! I just needed to enable websockets. Thanks for your help!

Re: Domoticz behind Nginx reverse proxy

Posted: Tuesday 07 June 2022 14:46
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:

Re: Domoticz behind Nginx reverse proxy

Posted: Wednesday 15 June 2022 20:49
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: