Websockets not working behind Skipper reverse proxy due to Transfer-Encoding: chunked #3798
Long story short
When running the websockets example server behind Skipper the websocket connection is dropped immediately after connect. "One or more reserved bits are on: reserved1 = 0, reserved2 = 1, reserved3 = 1"
Websocket connection is established without problems when running behind Skipper.
Websocket connection is dropped immediately after connect.
@szuecs helped to debug this issue and found that Transfer-Encoding: chunked seems to be the issue.
When i commented out the Transfer-Encoding header in:
The example started to work.
Steps to reproduce
This issue was initially raised @ miguelgrinberg/python-socketio#300
The text was updated successfully, but these errors were encountered:
I'm open to dropping Transfer-Encoding on WebSocket handshake.
@asvetlov I am also open to change skipper code. Maybe a configuration option to disable it in aiohttp project would be good.
What I don't understand is, that after connection upgrade, we Hijack the connection and only have 2 goroutines that copy data in both directions.
Any ideas what the problem could be?
I think that support an option to switch between chunked and plain cases in WebSocket upgrade doesn't make sense for aiohttp.
Regarding help with Skipper: sorry, I have no time to dig into the code.
My wild idea is: on WebSocket hijacking you don't switch the underlying parser back to plain mode. It reads chunk length but skips the delivering these 4 bytes to upstream, which corrupts the WebSocket protocol. Or something like this.