3

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.

Sergio
  • 161
  • 5

1 Answers1

1

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: myhost.com\n\n" | nc myhost.com 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.

beans
  • 1,550
  • 13
  • 16
  • 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