-
Notifications
You must be signed in to change notification settings - Fork 617
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
Support gzip compression for websockets #300
Comments
Is this on master? I think I've touched this code recently. I'll have a look later tonight. |
Yes I can reproduce this on master |
I was experimenting with master, because a similar issue regarding 500 errors and Websockets has been fixed recently and I was hoping that would solve my problem as it sounded very much like the same problem I am having. However, as you can see it was not the case. |
I'll fix that tonight |
I've pushed a fix that I think should fix this. Still need to write a test. Could you test this, please? |
I appreciate your fast reaction! Unfortunately, the fix did not seem to help. For reference, I am running fabio with these parameters:
Then I am doing the problematic request:
I've added a fmt.Println() at the same location described above (http_raw_handler.go#28) and it indeed is running into the "not a hijacker" block again. |
Here's how you can reproduce the problem:
|
It was worth a shot. I'll add a proper test and fix it. I've got a long weekend ahead so this will probably happen next week - just to set expectations. |
This patch fixes an error 500 when websocket clients are setting an Accept-Encoding: gzip header.
Fixed it in the wrong place. The new patch should fix it. Also, the websocket lib I'm using for testing doesn't make it easy to set headers. Therefore, writing a test requires a bit more work. I need to replace it anyway but I was able to reproduce the behavior with curl and the Could you have another look, please? |
I can confirm now that the fix is working. Thank you very much! |
Cool. I'll write a test and merge it. |
Accept-Encoding: gzip
header
A browser (at least chrome does it) usually sends an
Accept-Encoding: gzip
header with every request. For example:Now I am running fabio with gzip compression enabled and when i execute the example request fabio responds with a 500 error. It's not the upstream server sending the 500, but fabio. The error response is sent from here:
https://github.com/fabiolb/fabio/blob/master/proxy/http_raw_handler.go#L28
The reason this is failing is that
w
can't by type-cast (or how it's called in Go slang) to anhttp.Hijacker
, asw
is aGzipResponseWriter
.I am not sure if it's a proper fix, but what I've done to make it work was to modify the
acceptsGzip
function like this:The text was updated successfully, but these errors were encountered: