Apache – How to Disable HTTP Compression (mod_deflate) When SSL Stream is Compressed

apache-2.2compressionhttpsssl

I found that Goggle Chrome supports ssl compression and Firefox should support it soon.

I'm trying to configure Apache to to disable http compression if the ssl compression is used to prevent CPU overhead with the configuration option:

SetEnvIf SSL_COMPRESS_METHOD DEFLATE no-gzip

While the custom log (using %{SSL_COMPRESS_METHOD}x) shows that the ssl layer compression method is DEFLATE, the above option did not work and the http response content is still being compressed by Apache.

I had to use the option:

BrowserMatchNoCase ".*Chrome.*" no-gzip

I prefer if there is more general method in case other browsers support ssl compression in future or someone has a version of Chrome that does not have ssl compression.

Best Answer

Now after I got more information about the problem, I should answer my own question. This is a reported bug in Apache; Bug 49057 - setenvif should have access to SSL environment variables.

The bug is fixed in Apache 2.4.1 but this is not an option as I'm using CentOS 6.x.

I'll see if I can set no-gzip environment variable through the application instead of the Apache config.