How to disable mod_deflate in apache2?
Asked Answered
G

3

14

How can I disable mod_deflate in Apache2

  • For files in a specific directory

OR

  • For all files that have extension of, for example .py?
Greasepaint answered 17/12, 2009 at 16:28 Comment(0)
B
30

You could set the environment variable no-gzip for that directory/type of file:

# for URL paths that begin with "/foo/bar/"
SetEnvIf Request_URI ^/foo/bar/ no-gzip=1

# for files that end with ".py"
<FilesMatch \.py$>
    SetEnv no-gzip 1
</FilesMatch>
Blevins answered 17/12, 2009 at 16:42 Comment(2)
can I do it in .htaccess file inside that folder?Greasepaint
@Greasepaint Yes, if your <Directory> configuration in your main httpd.conf contains AllowOverride All.Ardeen
H
3

Quote from: scottlinux.com

Disable Compression: To disable compression in Apache, typically you just need to disable the module mod_deflate...

Debian/Ubuntu:

$ sudo a2dismod deflate
Module deflate disabled.
Run '/etc/init.d/apache2 restart' to activate new configuration!

$ sudo /etc/init.d/apache2 restart
Habitual answered 5/12, 2016 at 13:16 Comment(0)
C
2

Don't know if this is a general solution, but it worked for me at least, to turn of mod_deflate for .py-files within a .htaccess file in a certain folder:

SetEnvIfNoCase Request_URI "\.py$" no-gzip dont-vary
Clyte answered 1/5, 2013 at 14:31 Comment(1)
worked perfectly. I prefer a one-liner when debuggingBarleycorn

© 2022 - 2024 — McMap. All rights reserved.