v0.5.2
Bug Fixes
-
Fixed WebSocket connections being terminated immediately after handshake
The WebSocket proxy was experiencing premature disconnections due to two issues:
-
Server-side context cancellation: The HTTP request context (
r.Context()) was being used for the WebSocket pipe goroutine. When the HTTP handler returned after hijacking the connection, Go's HTTP server cancelled the request context, causing the WebSocket pipe to terminate immediately. Changed to usecontext.Background()for long-lived WebSocket connections. -
Server-side buffered data handling: The
bufio.ReadWriterreturned byHijack()was being discarded, which could cause loss of any buffered data from the client. Now properly handles buffered data usingbufferedReadWriteCloser.
-
-
Fixed WebSocket Host header not being forwarded correctly
When proxying WebSocket upgrade requests, only
req.URL.Hostwas being updated but notreq.Host. Sincehttp.Request.Write()usesreq.Hostfor the Host header, the original proxy hostname was being sent to the backend instead of the local target address. Now correctly setsreq.Hostto the target address and preserves the original host inX-Forwarded-Host.
What's Changed
- fix(tcp): Fixed a connection reading issue during WebSocket upgrade by @Gouryella in #10
Full Changelog: v0.5.1...v0.5.2
What's Changed
- fix(tcp): Fixed a connection reading issue during WebSocket upgrade by @Gouryella in #10
Full Changelog: v0.5.1...v0.5.2