> applications and middleware must not apply any kind of Transfer-Encoding
to their output, such as chunking or gzipping; as "hop-by-hop" operations,
these encodings are the province of the actual web server/gateway.
Since WSGI has become by far the most common way to deploy Django — I
don't even know any other way — Django should stop providing
`GzipMiddleware`.
This idea was approved by a BDFL on IRC:
{{{
20-00:10:33 jacobkm Oh and +1 on deprecating gzip middleware
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/19153>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
* has_patch: 0 => 1
Comment:
https://github.com/django/django/pull/455
--
Ticket URL: <https://code.djangoproject.com/ticket/19153#comment:1>
* stage: Accepted => Ready for checkin
Comment:
Doesn't merge cleanly against master, since docs/releases/1.5.txt is
probably intensively updated before release.
Patch works anyway.
--
Ticket URL: <https://code.djangoproject.com/ticket/19153#comment:2>
* stage: Ready for checkin => Accepted
Comment:
If it doesn't merge then it isn't ready for checkin :)
I created a ticket instead of doing it myself because I think this
deserves a serious discussion. Even though gzipping at the application
level in wrong in theory, tons of people are doing it and it works in
practice.
I'd like to see a discussion on django-developers before proceeding with
this deprecation.
--
Ticket URL: <https://code.djangoproject.com/ticket/19153#comment:3>
Comment (by Elvard):
Oh, I'm sorry, the problem with merge was only in docs/releases/1.5.txt
and it was trivial one.
--
Ticket URL: <https://code.djangoproject.com/ticket/19153#comment:4>
Comment (by aaugustin):
Since filing this bug, I've come across a use case for GzipMiddleware.
It requires running Django with `USE_ETAGS = True` behind nginx, with gzip
compression enabled. In this situation, nginx will remove the etag (in
modern versions) or keep it unchanged (in older versions). To get the
correct behavior — ie. gzipping if the client supports it, and a different
etag for the gzipped and non-gzipped version — you have to do the
compression in Django.
Related: #19705 and #16035.
--
Ticket URL: <https://code.djangoproject.com/ticket/19153#comment:5>
Comment (by timo):
Should we mark this as "won't fix" then?
--
Ticket URL: <https://code.djangoproject.com/ticket/19153#comment:6>
* status: new => closed
* resolution: => wontfix
--
Ticket URL: <https://code.djangoproject.com/ticket/19153#comment:7>
Comment (by alubbock):
This is an old ticket, but I thought it worth noting that recent versions
of nginx will now downgrade the Django-generated etag to a "weak" etag
rather than deleting it altogether when using nginx's gzip. At least for
nginx users, this seems to remove the need for gzip middleware.
--
Ticket URL: <https://code.djangoproject.com/ticket/19153#comment:8>