Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

`--http-websockets` incompatible with `--http-auto-gzip`? #190

anthonyrisinger opened this Issue Mar 24, 2013 · 6 comments


None yet
2 participants

anthonyrisinger commented Mar 24, 2013

...after i enable --http-websockets, uWSGI will no longer set/send Content-Encoding: gzip on my XHR requests.

why must one set uWSGI-Encoding: gzip anyway? is there some problem i'm unaware of, or is this just to allow selective gzipping?


http =
http-keepalive = 1
http-auto-chunked = 1
http-auto-gzip = 1
http-websockets = 1
add-header = uWSGI-Encoding: gzip

unbit commented Mar 24, 2013

add-header force the addition of the specified header to every request. You are basically forcing auto-gzip to every url. Auto-gzip remove the content-encoding header to avoid decoding error in the browser.

You may want to enable auto-gzip only to specific url, using internal routing. An example, enabling auto-gzip for all of the url not starting with /xhr

route-if-not = startswith:${PATH_INFO};/xhr addheader:uWSGI-Encoding: gzip


anthonyrisinger commented Mar 24, 2013

im not very familiar with websockets, but does that have a transfer encoding or sorts as well? or is websocket traffic compressed inherently/normally by default? i'm think i'm missing what you're trying to say.

i was thinking --http-auto-gzip was more of an opportunistic "gzip if client Accepts it and it makes sense" sort of thing, but from what you're saying it sounds like it's a little more of an explicit process, yes?


unbit commented Mar 25, 2013

websocket traffic (once the connection is established) bypass the whole HTTP logic. It is basically another protocol running on the same connection. Regarding auto-gzip, yes, it is an explicit process, the backend inform the http router that the content can be "gzipped" safely


anthonyrisinger commented Mar 25, 2013

ok cool cool, thanks for the info. AFAICT though, once --http-websockets is enabled, you can no longer --http-auto-gzip anything, which feels like we still have some kind of bug poking around in there.


unbit commented Aug 6, 2013

with the latest code i can confirm both works, can we close this ?


anthonyrisinger commented Aug 6, 2013

sure... i don't even recall what i was trying to do exactly, so your confirmation is as good as any.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment