cloudflare / cloudflare/cloudflared

🐛 cloudflared tunnel - websocket connection not working - 502 bad gateway

Open
#1,083 1 comment 0 reactions 0 assignees View on GitHub
Priority: Normal Type: Bug
Dominant language
Go
Stars
15.6k
Forks
1.4k
PR merge metrics
No merged PRs in 30d

Description

**Describe the bug**
Tunnelling a Websocket over the cloudflared Tunnel does not works

**To Reproduce**
Steps to reproduce the behavior:
1. Configure the Tunnel start it with
2. Open the Website Containing the Tunnel
3. See error in the Javascript Console

Bildschirmfoto 2023-10-17 um 01 15 08

Debug-Log of Cloudflared:

```
2023-10-16T23:10:42Z DBG GET https://refresh-sit-portrait-cargo.trycloudflare.com/ HTTP/1.1 cfRay=8173fa0bd1e6b397-MUC connIndex=0 content-length=0 event=1 headers={"Accept":["*/*"],"Accept-Encoding":["gzip"],"Accept-Language":["de-DE,de;q=0.9"],"Cache-Control":["no-cache"],"Cdn-Loop":["cloudflare; subreqs=1"],"Cf-Connecting-Ip":["***.****.****.****"],"Cf-Ew-Via":["15"],"Cf-Ipcountry":["IT"],"Cf-Ray":["8173fa0bd1e6b397-MUC"],"Cf-Visitor":["{\"scheme\":\"https\"}"],"Cf-Warp-Tag-Id":["09533866-fe49-43fc-84cf-64ea3ae6a01c"],"Cf-Worker":["trycloudflare.com"],"Origin":["https://refresh-sit-portrait-cargo.trycloudflare.com"],"Pragma":["no-cache"],"Sec-Websocket-Key":["jrhqNXgixOBkGEBeLsOmKQ=="],"Sec-Websocket-Version":["13"],"User-Agent":["Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/15.4 Safari/605.1.15"],"X-Forwarded-For":["***.****.****"],"X-Forwarded-Proto":["https"]} host=refresh-sit-portrait-cargo.trycloudflare.com ingressRule=0 path=/
2023-10-16T23:10:42Z DBG 502 Bad Gateway cfRay=8173fa0bd1e6b397-MUC connIndex=0 content-length=166 event=1
```

If it's an issue with Cloudflare Tunnel:
5. Tunnel ID : a1983976-8666-4900-818c-7e2480de6317
6. cloudflared config: (remote-managed)

**Expected behavior**
The Websocket should connect, how it is in Local

**Environment and versions**

```
root@webserver:~# cloudflared --version
cloudflared version 2023.8.2 (built 2023-08-31-1506 UTC)
```

What am I doing wrong? Is there an issue with cloudflared and websockets?

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.