Error with websockets


#1

Hi there!

I am running a instance of HA in a python virtual env, in a ubuntu server 17.

My HA version is 0.65.5

I have configured DuckDNS, lets encrypt, and dnsmasq for emulating NAT loopback, as my router doesn’t support it.

When I access from my internal network, with https://[INTERNAL_IP]:8123 everything works well
When I access from outside with https://[NAME].duckdns.org:8123 everything works well to

The problem is accessing from my internal network, with the duckdns url. It enters to the connecting page in chrome, but this call wss:///[NAME].duckdns.org:8123/api/websocket?latest doesn’t resolve. I have access to the server, because the https requests are working fine, but the websocket don’t, and I can’t find the cause.

I don’t have seen some topics about this, but it’s always related to proxys, and I am not using it.


I wonder if someone can guide me to the solution. Or at least, what kind of server is using HA by default, so I can dig into the configuration, and check if I can make a fix like in the nginx posts

Thanks!


#2

Im having this problem also.
Did you find a solution?


#3

Hi have the same issue,

HA version: 0.81.6 (Python 3.6.7)
OS: debian jessie (Raspberry Pi) Linux raspberrypi 4.14.78-v7+ #1156 SMP Tue Oct 23 14:34:39 BST 2018 armv7l GNU/Linux

When I access directly with :8123 I don’t have any issue.

But when I access through HTTPS (through freedns+Apache ProxyPass+LetsEncrypt certs) I have an error on wss: requests

(from chrome extension console)
"core-fe8f251c.js:1 WebSocket connection to ‘wss://myDomain/api/websocket’ failed: Error during WebSocket handshake: Unexpected response code: 500 "

I can’t see any details on HA logs.

Also I tried to configure through FreeNom + Cloudfare + Apache 80 (as described in https://domoticaencasa.es/foro/viewtopic.php?f=10&t=6 ) but I have the same error!

SOLVED: I’ve reviewed Apache2 logs
"AH01144: No protocol handler was valid for the URL /api/websocket . If you are using a DSO version of mod_proxy, make sure the proxy submodules are included in the configuration using LoadModule. "

Looking for stackoverflow, I’ve enable a lot of modules again:

sudo a2enmod ssl
sudo a2enmod proxy
sudo a2enmod proxy_balancer
sudo a2enmod proxy_http
sudo a2enmod proxy_wstunnel
sudo a2enmod proxy_fcgi

I’ve restarted … and voila!