louislam / uptime-kuma

A fancy self-hosted monitoring tool
https://uptime.kuma.pet
MIT License
55.89k stars 5.03k forks source link

(Cloudflare tunnel) Cannot connect to the socket server #1586

Closed freitasm closed 1 year ago

freitasm commented 2 years ago

⚠️ Please verify that this bug has NOT been raised before.

🛡️ Security Policy

📝 Describe your problem

Hi folks

Installed the image, running ok on [LAN IP]:3001. Continued to create a Cloudflare tunnel and all good, with the tunnel up.

Using Entry Page set to Dashboard the [subdomain].[domain].[tld] brings up an error "Cannot connect to the socket server. [Error: websocket error] Reconnecting..."

If I change Entry Page to "Status Page" then the status page loads fine.

Any ideas?

🐻 Uptime-Kuma Version

1.15.0

💻 Operating System and Arch

Synology docker

🌐 Browser

Microsoft Edge 100, Google Chrome 101

🐋 Docker Version

20.10.3-1305

🟩 NodeJS Version

No response

louislam commented 2 years ago

Not sure whether it is related, but worth to try.

image

freitasm commented 2 years ago

Thanks, but likely not related. I already had this enabled for a year now as I use https://www.myrtille.io/ and it relies on sockets.

AlisaAkiron commented 2 years ago

Cloudflare Tunnel does not support WebSocket :/ But maybe you can try this: https://community.cloudflare.com/t/tunnel-with-websockets/318111

freitasm commented 2 years ago

Thanks. That's interesting, seeing cloudflared/tunnel is explicitly supported and recommended in the documentation.

I will check post and work on the configuration.

Cheers

louislam commented 2 years ago

Cloudflare Tunnel does not support WebSocket :/ But maybe you can try this: https://community.cloudflare.com/t/tunnel-with-websockets/318111

As I am currently using Cloudflare tunnel, I can confirm it is working with WebSocket.

freitasm commented 2 years ago

Interesting. I can see the requests coming through Cloudflare firewall and being allowed. so there must be something else.

image

AlisaAkiron commented 2 years ago

OK, I have got it to work. It seems like my WAF rules (Managed Challenge to any HTTP/1.x requests) have sent a Managed Challenge to the WebSocket request which it could not complete.

Just set up a WAF rule to let this request pass and you're ready to go.

image
freitasm commented 2 years ago

Still doesn't work for me. I have created a rule at the very top. It allows traffic through but still getting the error:

image

image

louislam commented 2 years ago

May need to check the response with Chrome DevTools

image

github-actions[bot] commented 1 year ago

We are clearing up our old issues and your ticket has been open for 3 months with no activity. Remove stale label or comment or this will be closed in 7 days.

github-actions[bot] commented 1 year ago

This issue was closed because it has been stalled for 2 days with no activity.