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.



  • I tried to add this lines to .htaccess but the outcome is still the same. "SetEnv no-gzip dont-vary"
    – James W.
    Oct 8, 2012 at 6:03

1 Answer 1


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

SetEnv no-gzip 1
  • @ShaneMadded it doesn't work. It's still there.
    – James W.
    Oct 8, 2012 at 6:02
  • 3
    Ok, let's try the sledgehammer approach, then: RequestHeader unset Accept-Encoding Oct 8, 2012 at 6:04
  • it's gone. Thanks! How can I check correctly if the gzip compression is really disabled?
    – James W.
    Oct 8, 2012 at 6:08
  • 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. Oct 8, 2012 at 18:58
  • 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. Aug 18, 2020 at 19:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.