You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Dean Scarff <do...@scarff.id.au> on 2008/06/21 11:16:38 UTC

[users@httpd] 304 Not Modified and deflate OutputFilter

The deflate filter seems to break Apache's handling of the 304 Not
Modified status.

Apache package: apache2-mpm-prefork 2.2.8-1ubuntu0

In the Apache config, if I load mod_deflate and include:

  AddOutputFilterByType DEFLATE text/plain

Request /test.txt so the browser caches it, then request it again:

------------------------------------------------------------------------
GET /test.txt HTTP/1.1
Host: localhost
User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.4; en-GB; rv:1.9)
 Gecko/2008061004 Firefox/3.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-AU,en-GB;q=0.7,en;q=0.3
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 300
Connection: keep-alive
If-Modified-Since: Fri, 20 Jun 2008 12:36:57 GMT
If-None-Match: "21adc6-e-4501859732c40"-gzip
Cache-Control: max-age=0

HTTP/1.x 200 OK
Date: Sat, 21 Jun 2008 09:01:39 GMT
Server: Apache/2.2.8 (Ubuntu) DAV/2 PHP/5.2.4-2ubuntu5 with Suhosin-Patch
 mod_ssl/2.2.8 OpenSSL/0.9.8g
Last-Modified: Fri, 20 Jun 2008 12:36:57 GMT
Etag: "21adc6-e-4501859732c40"-gzip
Accept-Ranges: bytes
Vary: Accept-Encoding
Content-Encoding: gzip
Content-Length: 34
Keep-Alive: timeout=15, max=100
Connection: Keep-Alive
Content-Type: text/plain

[gzipped content]
------------------------------------------------------------------------

FWICS the response could 304 on the basis of either the Etag or
Last-Modified.  If I rename test.txt to some mime type that doesn't
have an associated outputfilter, the response 304s as expected.

Is this a bug?  How do I make httpd return a 304 status in this
situation, while still gzipping content where applicable?

-- 
Dean


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] 304 Not Modified and deflate OutputFilter

Posted by Nick Kew <ni...@webthing.com>.
On Sat, 21 Jun 2008 17:16:38 +0800
Dean Scarff <do...@scarff.id.au> wrote:

> The deflate filter seems to break Apache's handling of the 304 Not
> Modified status.

Correct.

This is a known issue that noone has found time to fix.
Patches welcome.

-- 
Nick Kew

Application Development with Apache - the Apache Modules Book
http://www.apachetutor.org/

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org