Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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
add comment

1 Answer

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.

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
add comment

Your Answer

 
discard

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.