I've added the next line during my Apache httpd.conf: -

AddOutputFilterByType DEFLATE text/html text/css application/javascript application/x-javascript application/json

I've got a html file (test.html) having a script inclusion: -

<script type="text/javascript" src="/test.js"></script>

The issue is, each time I load test.html, test.js can also be packed with HTTP status: 200.

Now you ask ,: Why conditional GET isn't satisfied?

Basically comment the "AddOutputFilterByType" line in httpd.conf, Apache transmits 304.

Basically enable AddOutputFilterByType in httpd.conf, the request header is: -


Host: optimize

User-Agent: Mozilla/5. (Home windows U Home windows NT 6. en-US rv:1.9..10) Gecko/2009042316 Opera/3..10 GTB5 (.Internet CLR 3.5.30729) FirePHP/.2.4

Accept: */*

Accept-Language: en-us,enq=.5

Accept-Encoding: gzip, deflate

Accept-Charset: ISO-8859-1,utf-8q=.7,*q=.7

Keep-Alive: 300

Connection: keep-alive

Referer: http://optimize/

Cookie: PHPSESSID=nbq6h0eeahkshkcbc6ctu2j2b4

If-Modified-Since: Tue, 19 May 2009 07:06:46 GMT

If-None-Match: "2000000000717f-2c25a-46a3e8dcc2ad8"-gzip

Cache-Control: max-age=

And also the response header is: -


Date: Comes to an end, 22 May 2009 07:03:40 GMT

Server: Apache/2.2.9 (Win32) PHP/5.2.6

Last-Modified: Tue, 19 May 2009 07:06:46 GMT

Etag: "2000000000717f-2c25a-46a3e8dcc2ad8"-gzip

Accept-Ranges: bytes

Vary: Accept-Encoding

Content-Encoding: gzip

Content-Length: 52583

Keep-Alive: timeout=5, max=98

Connection: Keep-Alive

Content-Type: application/javascript

UPDATE: I've observed, should i be crippling ETag, it really works correctly. I am talking about it transmits 304.

FileETag None

However I actually want to keep ETag because it is (I understand that there's a inode disclosure problem).

This can be a known bug in Apache. See Apache bug #45023, and summary of Apache 304 etags and mod_deflate.

Repairing from svn will fix the problem. The resolution ended up being to revert the modification that appended "-gzip" towards the etag. However, you will find connected HTTP compliance problems.

If you cannot rebuild Apache, there's a recommended runtime configuration workaround within the bug report:

<Location /test.js>
 RequestHeader  edit "If-None-Match" "^(.*)-gzip$" "$1"
 Header  edit "ETag" "^(.*[^g][^z][^i][^p])$" "$1-gzip"
</Location>

You may make use of a (squid) proxy which manipulates the HTTP Demands?