Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Apache with mod_deflate (uselessly) compresses even empty (PHP-generated) 302 redirect responses, adding a 20-byte response body. Modern browsers are ok with this but IE6 seems to randomly choke on that 20 bytes.

Is there a way to configure mod_deflate to ignore empty responses (or at least non-200 responses) ?

NOTE: I know I can disable deflate via SetEnvIfNoCase and BrowserMatch but I would really like to disable it just for what it does wrong: compressing empty responses.

share|improve this question

I don't think apache's 302 response bodies are are empty, but rather have some basic message about the response being moved. Therefore, mod_deflate is just doing its job.

Check it out with telnet or netcat -- here's a netcat example:

echo -e "GET / HTTP/1.1\nHost:\n\n" | nc 80

If you want to change that, you can use an ErrorDocument to tell apache to serve your custom file for 302 responses. Your file would need to be smart enough to read the appropriate environment variables to do the redirect itself, but then can you can leave the body empty -- or better yet set a different Content-Type header that mod_deflate won't match.

share|improve this answer
Sorry, I forgot to mention that the 302 responses are PHP generated and are empty. Anyway, you have a good point on the Content-Type, I'll try and fake that and see what happens. – Sergio Feb 14 '11 at 10:33
Did switching the Content-Type work ? Or did that cause issues with browsers ? Everybody seems to be using text/html for redirects. – Gene Vincent Nov 21 '13 at 12:07

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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