WebSocket connection failed. Response 404

1. Caddy version (caddy version):


2. How I run Caddy:

a. System environment:

Ubuntu 20.04 (LTS) x64

b. Command:

systemctl start caddy

d. My complete Caddyfile or JSON config:

bridge.mydomain.com {
        reverse_proxy localhost:8887

3. The problem I’m having:

I am running an instance of wallet connect bridge, which runs at localhost:8887 and have my domain DNS pointed at my server ipv4. I am using caddy to reverse_proxy the domain. Everything works absolutely fine from mobile browsers Chrome and Safari, but from desktop browsers Chrome/Firefox I get the websocket connection error. What changes do I need to make to my caddy file to allow the websocket connection?

4. Error messages and/or full log output:

WebSocket connection to 'wss://bridge.mydomain.com/' failed: Error during WebSocket handshake: Unexpected response code: 404

There’s nothing to change in the Caddyfile, that’s the way to do it. The 404 is most likely coming from your upstream app. It’s hard to say why. Make sure that your upstream app isn’t expecting to see a different Host header, or possibly something else.

Hmm okay. Very odd as it works on mobile browsers no problem

Caddy doesn’t make any distinction, so it must be something different about the requests being made that your backend doesn’t know how to handle.

See if you can enable debug level logging on your upstream app.

You can also enable debug level logging in Caddy by adding this at the top of your Caddyfile:

1 Like

You’re right, definitely a bug upstream of Caddy. If I restart my machine every works seamlessly on desktop (mobile was never an issue). I can reintroduce the bug if I fire up a web3modal QR code but never connect to it on my device - super weird.

Thanks for your help!

1 Like

It’s actually being caused by my VPN

1 Like

This topic was automatically closed after 30 days. New replies are no longer allowed.