cloudflared icon indicating copy to clipboard operation
cloudflared copied to clipboard

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

Open Mongey opened this issue 4 years ago • 5 comments

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\n<a href=\"/ui/\">Temporary Redirect</a>.\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)

Mongey avatar Aug 10 '21 13:08 Mongey

Have you checked to ensure the requests are not getting blocked by Bot Fight Mode or the Firewall?

chris-martinelli avatar Aug 10 '21 23:08 chris-martinelli

@chris-martinelli yep, nothing blocked there.

Mongey avatar Aug 10 '21 23:08 Mongey

Me waiting fr this to resolve 🥲

ghost avatar Apr 25 '22 13:04 ghost

Cmon man resolve this its 2 much l8

ghost avatar Apr 25 '22 13:04 ghost

@MOOGAA This error can surface when a few conditions exist. Have you gone through this troubleshooting guide to ensure client side cloudflared is properly configured?

abelinkinbio avatar Apr 26 '22 15:04 abelinkinbio