-
-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Websockets not working behind Skipper reverse proxy due to Transfer-Encoding: chunked #3798
Comments
That's interesting. 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 added a PR which detects websockets and does not add the chunked header. |
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. |
@asvetlov thanks for your input. |
…#3800) (cherry picked from commit 79c1ca4) Co-authored-by: Florian S <[email protected]>
Fixed by #3800 |
…#3800) (#3920) (cherry picked from commit 79c1ca4) Co-authored-by: Florian S <[email protected]>
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"
Expected behaviour
Websocket connection is established without problems when running behind Skipper.
Actual behaviour
Websocket connection is dropped immediately after connect.
"One or more reserved bits are on: reserved1 = 0, reserved2 = 1, reserved3 = 1"
Wireshark output
@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.
Question: Is Transfer encoding really necessary for websockets or could it be removed / made optional to increase compatibility with http proxy servers like Skipper?
Steps to reproduce
web_ws.py
exampleYour environment
This issue was initially raised @ miguelgrinberg/python-socketio#300
The text was updated successfully, but these errors were encountered: