vulcand / oxy

Go middlewares for HTTP servers & proxies
Apache License 2.0
2.02k stars 324 forks source link

Bug on X-Forwarded-For header on websocket handshake #205

Closed mathieulaporte closed 2 years ago

mathieulaporte commented 4 years ago

Hello,

I discovered that the X-Forwarded-For header was missing when handshaking for a websocket connection. This is because the headers to identify a websocket handshake are removed here: https://github.com/vulcand/oxy/blob/master/forward/fwd.go#L507.

This has the effect that "IsWebsocketRequest" (https://github.com/vulcand/oxy/blob/master/forward/fwd.go#L570) returns false here https://github.com/vulcand/oxy/blob/master/forward/rewrite.go#L31.

The easiest way to fix this bug would be to leave the headers but I don't know why they were removed.

ldez commented 2 years ago

Considering refactoring #229, the specific code for WebSocket has been removed.