cloudflare / cloudflare/cloudflared

cloudflared access tcp: ERR failed to connect to origin error="websocket: bad handshake"

Open
#435 5 comments 1 reaction 0 assignees View on GitHub
Dominant language
Go
Stars
15.6k
Forks
1.4k
PR merge metrics
No merged PRs in 30d

Description

I'm attempting to connect to an connect to an access app via the cli, but, for some reason it fails.

```
> cloudflared access tcp --hostname https://nomad.example.org --listener localhost:8080 --log-level debug
```
```
> curl localhost:8080
curl: (56) Recv failure: Connection reset by peer
```

```
2021-08-10T13:43:10Z INF Start Websocket listener host=localhost:8080
2021-08-10T13:43:11Z DBG Websocket request: GET / HTTP/1.1
Host: nomad.example.org

2021-08-10T13:43:13Z DBG Access Websocket request: GET / HTTP/1.1
Host: nomad.example.org
Cf-Access-Token: my-token

2021-08-10T13:43:13Z DBG Websocket response: "HTTP/1.1 307 Temporary Redirect\r\nTransfer-Encoding: chunked\r\nCf-Cache-Status: DYNAMIC\r\nCf-Ray: 67c9a6e45dff34c6-DUB\r\nConnection: keep-alive\r\nContent-Type: text/html; charset=utf-8\r\nDate: Tue, 10 Aug 2021 13:43:13 GMT\r\nExpect-Ct: max-age=604800, report-uri=\"https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct\"\r\nLocation: /ui/\r\nServer: cloudflare\r\nVary: Accept-Encoding\r\n\r\n28\r\nTemporary Redirect.\n\n\r\n0\r\n\r\n"
2021-08-10T13:43:13Z ERR failed to connect to origin error="websocket: bad handshake" originURL=https://nomad.example.org

```

It's getting the expected response from the origin server, but `cloudflared` is not returning it.

`cloudflared access curl https://nomad.example.org` works as expected.

#### version
```
> cloudflared version
cloudflared version 2021.8.2 (built 2021-08-09-1729 UTC)
```

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.