I am looking to disable the gzip folder for folder xxx. looking in StackOverflow, I have tried this :
SetEnvIf Request_URI ^/xxx(.*) no-gzip dont-vary
But it doesn't work.
I have added in here :
<IfModule mod_deflate.c>
SetEnvIf Request_URI ^/flipbook(.*) no-gzip dont-vary
# enables the filter
SetOutputFilter DEFLATE
# non-textual entities should be already compressed
AddOutputFilterByType DEFLATE text/css
AddOutputFilterByType DEFLATE text/javascript
AddOutputFilterByType DEFLATE text/html
AddOutputFilterByType DEFLATE text/xml
AddOutputFilterByType DEFLATE application/javascript
AddOutputFilterByType DEFLATE application/x-javascript
</IfModule>
and even outside the mod_deflate module but nothing works.
Could anyone help?
This looks like it should work - for any URL that starts
/flipbook(case-sensitive). Setting theno-gzipenvironment variable disables the DEFLATE filter of mod_deflate.However, the
(.*)part on the regex is entirely superfluous. And, unless you are specifically using thedont-varyenv var in your own directives then this isn't doing anything. I don't thinkdont-varyis a "special" Apache env var. Apache hasforce-no-vary, which does whatdont-varyis probably intended to do, however, I don't believe you should be disabling theVaryheader anyway since mod_deflate applies the filter based on theAccept-EncodingHTTP request header sent from the client, so any intermediary caching proxies should cache based on this header. (Only certain proxies have a problem with this header.)So, this should be written:
Reference:
This doesn't just "enable the filter", it enables the DEFLATE filter on all responses. This basically renders the
AddOutputFilterByTypedirectives that follow superfluous, since you are already setting DEFLATE on everything. Generally, you don't want to set it on everything, which is presumably why you are using theAddOutputFilterByTypedirectives.So, you probably don't need the
SetOutputFilterdirective, if you are setting the DEFLATE on specific mime-types. OR, you useSetOutputFilterand remove theAddOutputFilterByTypedirectives, but then you should still disable the filter on images and other already compressed media using theno-gzipenv var.You don't need all 3. Your server is setting just one mime-type when sending JavaScript files - which you can see in the HTTP response. You only need that one. (Probably
application/javascript.)Alternative solution
Instead of setting the
no-gzipenv var to disable mod_default, you could instead use an Apache<If>expression to conditionally set the output filters only when not accessing URLs that start/flipbook.For example:
You don't really need the
<IfModule>wrapper unless you intend to port the same code to multiple servers where mod_deflate might not be enabled (and that is acceptable).