Content blocked because of insecure. [https]
1dotd4 opened this issue · 6 comments
On Safari:
[blocked] The page at https://my-server/?your-channel was not allowed to run insecure content from ws://my-server:6060.
On Chrome:
VM56:35 Mixed Content: The page at 'https://my-server/?your-channel' was loaded over HTTPS, but attempted to connect to the insecure WebSocket endpoint 'ws://my-server:6060/'. This request has been blocked; this endpoint must be available over WSS.WrappedWebSocket @ VM56:35
VM56:35 Uncaught DOMException: Failed to construct 'WebSocket': An insecure WebSocket connection may not be initiated from a page loaded over HTTPS.(…)
Most browsers will not allow you to load unencrypted content inside a page with an HTTPS protocol, to keep its promise that the page is secure. The solution is to make the WebSocket secure by routing it through a proxy. I use Nginx with the following server config block.
server {
listen 443 ssl;
...
location /chat {
proxy_pass http://localhost:6060;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_read_timeout 300;
}
}
Then the WebSocket URL will be wss://my-server/chat
still doesn't work, same error
You also need to change the URL found here https://github.com/AndrewBelt/hack.chat/blob/master/client/client.js#L67 to use the wss protocol.
I did and now the page doesn't show error but it doesn't work too
There's nothing in the Web Console?
It was a lot of little things...
nodejs not updated
nodejs-legacy not installed
and more