First of all thank you for this amazing piece of software you’ve written. I had been looking for such a thing for some time and yesterday just stumbled on to your server from Lets Encrypt’s site link. Tried it, loved it and now I’m converting our nginx configs to caddy. All was good until I ran into a websocket and there’s where our story begins:
What am I trying to do:
Proxying a simple websocket connection using a sample go server: github: go-websocket-sample/master/server.go
What I’ve already tried
Other than researching this for the past 24 hours, going through documentation, various examples under caddyserver repo, and searching this forum / github issues, stackoverflow questions, I’m not sure how to answer this question. I’ve reduced the problem down the absolute minimal Cadyfile:
http://localhost:4051 {
proxy /wstime ws://localhost:4050/wstime {
websocket
}
}
where localhost:4050/wstime
is the sample server linked above that pushes timestamps on connect and works flawlessly on its own.
I’m using https://www.websocket.org/echo.html client connecting to ws://localhost:4050/wstime
verifying that server is responding. However, switching it to ws://localhost:4051/wstime
returns 502 instead.
Error information returned in chrome:
WebSocket connection to ‘ws://localhost:4051/wstime’ failed: Error during WebSocket handshake: Unexpected response code: 502
Environment Information:
OS: Windows 10 Creators Update / Gentoo Linux
Go version: 1.8.1
Caddy version: 0.10.0, 0.10.2, master/HEAD @ 958abcf – v0.10.2-9-g958abcf (tried various versions in case there was a bug fix I don’t have)
How did I run caddy: caddy
(just plain exe picking Caddyfile from current folder)
If i’ve missed something, please feel free to ask.