Skip to content

v0.5.2

Choose a tag to compare

@Gouryella Gouryella released this 19 Dec 09:58
· 71 commits to main since this release
ddefbbd

Bug Fixes

  • Fixed WebSocket connections being terminated immediately after handshake

    The WebSocket proxy was experiencing premature disconnections due to two issues:

    1. 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 use context.Background() for long-lived WebSocket connections.

    2. Server-side buffered data handling: The bufio.ReadWriter returned by Hijack() was being discarded, which could cause loss of any buffered data from the client. Now properly handles buffered data using bufferedReadWriteCloser.

  • Fixed WebSocket Host header not being forwarded correctly

    When proxying WebSocket upgrade requests, only req.URL.Host was being updated but not req.Host. Since http.Request.Write() uses req.Host for the Host header, the original proxy hostname was being sent to the backend instead of the local target address. Now correctly sets req.Host to the target address and preserves the original host in X-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