Websocket 426 Error, with LiveView


I have developed some things with LiveView. All is working on my machine (how many times I would have said that …), and also on the test server. The problem is that it is not working on the production server. If I open Firefox’s developer tools, I can see an error message:

Firefox can’t establish a connection to the server at wss://mydomain.com/live/websocket?vsn=2.0.0

And after that, an HTTP failed request with code 426 Upgrade Required.

Do you know what am I doing wrong?

Thanks in advance.


Is your production box behind a load balancer / reverse proxy of any kind? Maybe it doesn’t allow upgrade requests through, then cowboy would respond with 426 probably, since it expects one. But that’s just speculation.


Nop. The connection goes directly to Cowboy.

I have done some tests, finding out that when I configure Phoenix with server IP instead of domain and access directly to that IP, all works without problems.

Could be related to https?

Can you post this configuration here?

Never mind. I find out that there is a Caddy reverse proxy configured. After configuring it with proper WebSockets configuration, all is working fine.

Thanks for your help.

1 Like