Welcome to WebmasterWorld Guest from 54.198.118.102

Forum Moderators: Ocean10000 & incrediBILL & phranque

Message Too Old, No Replies

Apache gzip compression does not work on all files

gzip compression seems to work on html not other files

     
5:50 am on Nov 11, 2013 (gmt 0)

New User

10+ Year Member

joined:July 18, 2005
posts: 30
votes: 0


Hi All,

I am trying to get the compression to work however seems like its not.

I have referred to a few threads in these forums
e.g. [webmasterworld.com...]
[webmasterworld.com...]

With no success.

I have added the below code to the httpd.conf file


# compress text, html, javascript, css, xml:
AddOutputFilterByType DEFLATE text/plain
AddOutputFilterByType DEFLATE text/html
AddOutputFilterByType DEFLATE text/xml
AddOutputFilterByType DEFLATE text/css
AddOutputFilterByType DEFLATE application/xml
AddOutputFilterByType DEFLATE application/xhtml+xml
AddOutputFilterByType DEFLATE application/rss+xml
AddOutputFilterByType DEFLATE application/javascript
AddOutputFilterByType DEFLATE application/x-javascript



From Live HTTP header I get the following:
HTTP/1.0 200 OK
Date: Mon, 11 Nov 2013 04:33:35 GMT
Server: Apache-Coyote/1.1
Content-Type: text/html;charset=UTF-8
Content-Language: en
Vary: Accept-Encoding
Content-Encoding: gzip
X-Cache: MISS from ssc-ibm-pxy-01.example.com.au
Proxy-Connection: close
----------------------------------------------------------
http://betauat.example.com.au/_ui/desktop/common/js/jquery-1.7.2.min.js

GET /_ui/desktop/common/js/jquery-1.7.2.min.js HTTP/1.1
Host: betauat.example.com.au
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:25.0) Gecko/20100101 Firefox/25.0
Accept: */*
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate
Referer: http://betauat.example.com.au/
Cookie: JSESSIONID=82A7AAB0F1A5BAD44E5C54576B60E59C;
Connection: keep-alive
If-Modified-Since: Thu, 03 Oct 2013 20:20:16 GMT
If-None-Match: W/"94840-1380831616000"

HTTP/1.0 304 Not Modified
Date: Mon, 11 Nov 2013 04:33:35 GMT
Server: Apache-Coyote/1.1
Etag: W/"94840-1380831616000"
Cache-Control: no-cache,must-revalidate
X-Cache: MISS from ssc-ibm-pxy-01.example.com.au
Proxy-Connection: keep-alive
----------------------------------------------------------
http://betauat.example.com.au/_ui/desktop/common/blueprint/print.css

GET /_ui/desktop/common/blueprint/print.css HTTP/1.1
Host: betauat.example.com.au
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:25.0) Gecko/20100101 Firefox/25.0
Accept: text/css,*/*;q=0.1
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate
Referer: http://betauat.example.com.au/
Cookie: JSESSIONID=82A7AAB0F1A5BAD44E5C54576B60E59C;
Connection: keep-alive
If-Modified-Since: Thu, 03 Oct 2013 20:20:16 GMT
If-None-Match: W/"1336-1380831616000"

HTTP/1.0 304 Not Modified
Date: Mon, 11 Nov 2013 04:33:35 GMT
Server: Apache-Coyote/1.1
Etag: W/"1336-1380831616000"
Cache-Control: no-cache,must-revalidate
Vary: Accept-Encoding
X-Cache: MISS from ssc-ibm-pxy-01.example.com.au
Proxy-Connection: keep-alive


The above is not the full info that Live HTTP header spits out.

I am using Google Chrome Developer Tools to check if the compressions are working or not.

The Chrome dev tool displays the following message for a few .js and .css files
"Compressing the following resources with gzip could reduce their transfer size by about two thirds (~8.8 KB)"

Any help/pointers much appreciated.

Thank you for your time and help.

cheers.
8:26 pm on Nov 11, 2013 (gmt 0)

Administrator

WebmasterWorld Administrator phranque is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month

joined:Aug 10, 2004
posts:10847
votes: 61


this is the answer:
If-Modified-Since: Thu, 03 Oct 2013 20:20:16 GMT
If-None-Match: W/"94840-1380831616000"

HTTP/1.0 304 Not Modified


in other words, you aren't getting any "content" in the response, so there's nothing to compress.
8:30 pm on Nov 11, 2013 (gmt 0)

Administrator

WebmasterWorld Administrator phranque is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month

joined:Aug 10, 2004
posts:10847
votes: 61


try sending a request without the If-Modified-Since: and If-None-Match: headers or change the modified date on the file.
4:32 am on Nov 12, 2013 (gmt 0)

New User

10+ Year Member

joined:July 18, 2005
posts: 30
votes: 0


Thank you for your response.

I added the following code to httpd.conf.
<FilesMatch "\.(js|css)$">
RequestHeader unset If-Modified-Since
</FilesMatch>



Using Page Speed for Chrome Developer tool displays following:


Enable compression for the following resources to reduce their transfer size by 232.8KiB (71% reduction).
Compressing [betauat.example.com.au...] could save 154.5KiB (75% reduction).
Compressing [betauat.example.com.au...] could save 59.7KiB (64% reduction).
Compressing [betauat.example.com.au...] could save 18.6KiB (72% reduction).



and Live HTTP header displays


http://betauat.example.com.au/

GET / HTTP/1.1
Host: betauat.example.com.au
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:25.0) Gecko/20100101 Firefox/25.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate
Cookie: JSESSIONID=E3FB1C455C676663EBEAF1253F9E9006;
Connection: keep-alive
Pragma: no-cache
Cache-Control: no-cache

HTTP/1.0 200 OK
Date: Tue, 12 Nov 2013 01:05:24 GMT
Server: Apache-Coyote/1.1
Content-Type: text/html;charset=UTF-8
Content-Language: en
Vary: Accept-Encoding
Content-Encoding: gzip
X-Cache: MISS from ssc-ibm-pxy-01.example.com.au
Proxy-Connection: close
----------------------------------------------------------
http://betauat.example.com.au/_ui/desktop/common/js/jquery-1.7.2.min.js

GET /_ui/desktop/common/js/jquery-1.7.2.min.js HTTP/1.1
Host: betauat.example.com.au
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:25.0) Gecko/20100101 Firefox/25.0
Accept: */*
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate
Referer: http://betauat.example.com.au/
Cookie: JSESSIONID=E3FB1C455C676663EBEAF1253F9E9006;
Connection: keep-alive
Pragma: no-cache
Cache-Control: no-cache

HTTP/1.0 200 OK
Date: Tue, 12 Nov 2013 01:05:24 GMT
Server: Apache-Coyote/1.1
Cache-Control: no-cache,must-revalidate
Accept-Ranges: bytes
Etag: W/"94840-1380831616000"
Last-Modified: Thu, 03 Oct 2013 20:20:16 GMT
Content-Type: text/javascript;charset=UTF-8
Content-Length: 94840
X-Cache: MISS from ssc-ibm-pxy-01.example.com.au
Proxy-Connection: keep-alive
----------------------------------------------------------
http://betauat.example.com.au/_ui/desktop/common/blueprint/print.css

GET /_ui/desktop/common/blueprint/print.css HTTP/1.1
Host: betauat.example.com.au
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:25.0) Gecko/20100101 Firefox/25.0
Accept: text/css,*/*;q=0.1
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate
Referer: http://betauat.example.com.au/
Cookie: JSESSIONID=E3FB1C455C676663EBEAF1253F9E9006; _ga=GA1.3.374274485.1383872524; __utma=11309623.374274485.1383872524.1384207729.1384218219.7; __utmc=11309623; __utmz=11309623.1383872524.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none); __utmb=11309623.3.10.1384218219
Connection: keep-alive
Pragma: no-cache
Cache-Control: no-cache

HTTP/1.0 200 OK
Date: Tue, 12 Nov 2013 01:05:24 GMT
Server: Apache-Coyote/1.1
Cache-Control: no-cache,must-revalidate
Accept-Ranges: bytes
Etag: W/"1336-1380831616000"
Last-Modified: Thu, 03 Oct 2013 20:20:16 GMT
Content-Type: text/css;charset=UTF-8
Vary: Accept-Encoding
Content-Encoding: gzip
Content-Length: 694
X-Cache: MISS from ssc-ibm-pxy-01.example.com.au
Proxy-Connection: keep-alive
----------------------------------------------------------
http://betauat.example.com.au/_ui/desktop/theme-default/images/favicon.ico

GET /_ui/desktop/theme-default/images/favicon.ico HTTP/1.1
Host: betauat.example.com.au
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:25.0) Gecko/20100101 Firefox/25.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate
Cookie: JSESSIONID=E3FB1C455C676663EBEAF1253F9E9006; _ga=GA1.3.374274485.1383872524; __utma=11309623.374274485.1383872524.1384207729.1384218219.7; __utmc=11309623; __utmz=11309623.1383872524.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none); __utmb=11309623.3.10.1384218219
Connection: keep-alive
If-Modified-Since: Thu, 03 Oct 2013 20:20:16 GMT
If-None-Match: W/"1150-1380831616000"

HTTP/1.0 304 Not Modified
Date: Tue, 12 Nov 2013 01:05:24 GMT
Server: Apache-Coyote/1.1
Etag: W/"1150-1380831616000"
Cache-Control: no-cache,must-revalidate
X-Cache: MISS from ssc-ibm-pxy-01.example.com.au
Proxy-Connection: keep-alive
----------------------------------------------------------
5:08 am on Nov 12, 2013 (gmt 0)

Senior Member

WebmasterWorld Senior Member Top Contributors Of The Month

joined:July 19, 2013
posts:1097
votes: 0


... Original

AddOutputFilterByType DEFLATE text/plain
AddOutputFilterByType DEFLATE text/html
AddOutputFilterByType DEFLATE text/xml
AddOutputFilterByType DEFLATE text/css
AddOutputFilterByType DEFLATE application/xml
AddOutputFilterByType DEFLATE application/xhtml+xml
AddOutputFilterByType DEFLATE application/rss+xml
AddOutputFilterByType DEFLATE application/javascript
AddOutputFilterByType DEFLATE application/x-javascript

... Response

GET /_ui/desktop/common/js/jquery-1.7.2.min.js HTTP/1.1
Host: betauat.example.com.au
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:25.0) Gecko/20100101 Firefox/25.0
Accept: */*
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate
Referer: http://betauat.example.com.au/
Cookie: JSESSIONID=E3FB1C455C676663EBEAF1253F9E9006;
Connection: keep-alive
Pragma: no-cache
Cache-Control: no-cache

HTTP/1.0 200 OK
Date: Tue, 12 Nov 2013 01:05:24 GMT
Server: Apache-Coyote/1.1
Cache-Control: no-cache,must-revalidate
Accept-Ranges: bytes
Etag: W/"94840-1380831616000"
Last-Modified: Thu, 03 Oct 2013 20:20:16 GMT
Content-Type: text/javascript;charset=UTF-8
Content-Length: 94840
X-Cache: MISS from ssc-ibm-pxy-01.example.com.au
Proxy-Connection: keep-alive

... Edited

AddOutputFilterByType DEFLATE text/plain
AddOutputFilterByType DEFLATE text/html
AddOutputFilterByType DEFLATE text/xml
AddOutputFilterByType DEFLATE text/css
AddOutputFilterByType DEFLATE text/javascript
AddOutputFilterByType DEFLATE application/xml
AddOutputFilterByType DEFLATE application/xhtml+xml
AddOutputFilterByType DEFLATE application/rss+xml
AddOutputFilterByType DEFLATE application/x-javascript

;)
7:45 am on Nov 12, 2013 (gmt 0)

Administrator

WebmasterWorld Administrator phranque is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month

joined:Aug 10, 2004
posts:10847
votes: 61


I added the following code to httpd.conf.


make sure to remove that after testing.
an appropriate 304 response is more efficient than a compressed file.
11:07 pm on Nov 12, 2013 (gmt 0)

New User

10+ Year Member

joined:July 18, 2005
posts: 30
votes: 0


Thanks heaps JD_Toims and phranque.

I will test it and let you know how it goes.

Appreciate your time and help.

Out of curiosity, from the above header response, how did you know that the files are not compressed?

The only way I know is because Chrome dev tool says so.
11:30 pm on Nov 12, 2013 (gmt 0)

Administrator

WebmasterWorld Administrator phranque is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month

joined:Aug 10, 2004
posts:10847
votes: 61


from the above header response, how did you know that the files are not compressed?


the absence of this header:
Content-Encoding: gzip
10:35 pm on Nov 17, 2013 (gmt 0)

New User

10+ Year Member

joined:July 18, 2005
posts: 30
votes: 0


Thank you all.

The compressions working now :-)
 

Join The Conversation

Moderators and Top Contributors

Hot Threads This Week

Featured Threads

Free SEO Tools

Hire Expert Members