4

Im using Apache and I have enabled zip compression to all my virtual host domain. However, I want to disable the gzip compression on one particular virtual host only. I try this method.

All separated virtual host file i.e. domain.com.conf has this lines to enable the compression - http://pastebin.com/LV6Tyv38

Now, I created domain1.com.conf without inculding compression line stated on the link and I expect gzip compression is disabled only for domain1.com. BUT, when I checked the HTTP header, I can still get these outcome.

Content-Encoding: gzip
Vary: Accept-Encoding

I would appreciate if anyone could help me to shed some lights on how to properly disabled zip compression for a particular virtual host in apache.

Thanks.

JamesW

James W.
  • 749
  • 2
  • 7
  • 12
  • I tried to add this lines to .htaccess but the outcome is still the same. "SetEnv no-gzip dont-vary" – James W. Oct 08 '12 at 06:03

1 Answers1

3

There really shouldn't be any reason to disable it, but..

SetEnv no-gzip 1
Shane Madden
  • 114,520
  • 13
  • 181
  • 251
  • @ShaneMadded it doesn't work. It's still there. – James W. Oct 08 '12 at 06:02
  • 3
    Ok, let's try the sledgehammer approach, then: `RequestHeader unset Accept-Encoding` – Shane Madden Oct 08 '12 at 06:04
  • it's gone. Thanks! How can I check correctly if the gzip compression is really disabled? – James W. Oct 08 '12 at 06:08
  • When I use "Developer Tools" of Google chrome, I still can see this header -- "Accept-Encoding:gzip,deflate,sdch"... But on normal header checker like online tool or addons of the browser for http header, it doesn't appear those line. – James W. Oct 08 '12 at 06:21
  • 4
    Your client's not being prevented from sending the header (so you're still seeing that request header being sent), we're just having the Apache server discard it (so that it thinks the client doesn't support compression at all) before `mod_deflate` gets a chance to do compression. The fact that the `Content-Encoding` is no longer gzip means that it's working. – Shane Madden Oct 08 '12 at 18:58
  • A good reason to disabling it is to measure speed connection. – david.perez Nov 25 '16 at 10:50
  • 1
    Disabling compression also mitigates against the BREACH attack, so it is not true that "there is no reason to disable it". Maybe for HTTP, but for HTTPS there are legitimate reasons. – InterLinked Aug 18 '20 at 19:16