cloudflare / cloudflare/cloudflared

🐛 Upgrade header stripped on Websocket POST requests

Open
#883 27 comments 35 reactions 0 assignees View on GitHub
Confirmed 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**
- If a Websocket connection is attempted over a Tunnel, with a POST method (uncommon but valid), `cloudflared` strips the Upgrade header so the websocket fails.

**To Reproduce**
Steps to reproduce the behavior:
1. Create a Tunnel, and run it with the `--loglevel debug` flag so that you can see all incoming headers. No origin is required as long as you can see the incoming headers.
2. Make a Websocket connection via POST (this is used in applications such as self-hosted Tailscale AKA Headscale, might be a bit tricky to do manually however).
3. Observe that there is no Upgrade header (required to establish Websockets) even though the client sends one
4. Tunnel ID: 1c9fa586-d2e8-407d-a637-f578d90132c4
5. Config: dashboard-managed, simple `example.com` -> `http://localhost:80`

**Expected behavior**
- The Upgrade header is forwarded with the request so the Websocket can be established.

**Environment and versions**
- OS: Linux
- Architecture: AMD64
- Version: `cloudflared version 2023.1.0 (built 2023-01-16-0850 UTC)`

**Logs and errors**
- Not really applicable, just that a header is being stripped on POST websocket requests only (not on GET)

**Additional context**
- N/A

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.