Questions tagged [mod-deflate]

The mod_deflate is an Apache web server module that provides the DEFLATE output filter that allows output from your server to be compressed before being sent to the client over the network.

The mod_deflate is an Apache web server module that provides the DEFLATE output filter that allows output from your server to be compressed before being sent to the client over the network.

Simplest configuration is made by putting the following line in the .htaccess file:

AddOutputFilterByType DEFLATE text/html text/plain text/xml

The following configuration, while resulting in more compressed content, is also much more complicated. Do not use this unless you fully understand all the configuration details. Compress everything except images:

<Location />
    # Insert filter
    SetOutputFilter DEFLATE

    # Netscape 4.x has some problems...
    BrowserMatch ^Mozilla/4 gzip-only-text/html

    # Netscape 4.06-4.08 have some more problems
    BrowserMatch ^Mozilla/4\.0[678] no-gzip

    # MSIE masquerades as Netscape, but it is fine
    BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
    # Don't compress images
    SetEnvIfNoCase Request_URI \
    \.(?:gif|jpe?g|png)$ no-gzip dont-vary

    # Make sure proxies don't deliver the wrong content
    Header append Vary User-Agent env=!dont-vary
</Location>
165 questions
55
votes
10 answers

How can I get Apache gzip compression to work?

I can't get my site to use gzip compression. I recently watched this video by Chris Coyier over at css-tricks.com. In the video, he talks about enabling gzip compression to make websites run faster. As per his instruction, I linked through to…
dai.hop
  • 763
  • 2
  • 11
  • 13
34
votes
8 answers

How can I pre-compress files with mod_deflate in Apache 2.x?

I am serving all content through apache with Content-Encoding: zip but that compresses on the fly. A good amount of my content is static files on the disk. I want to gzip the files beforehand rather than compressing them every time they are…
Otto
  • 16,619
  • 14
  • 54
  • 62
32
votes
6 answers

mod_deflate vs mod_gzip

Can someone tell me the difference in the following scripts in terms of CPU load performance and compression? mod_gzip_on Yes mod_gzip_dechunk Yes mod_gzip_item_include file \.(html?|txt|css|js|php|pl)$…
Bachalo
  • 5,885
  • 22
  • 86
  • 175
27
votes
4 answers

Apache is not sending 304 response (if mod_deflate and AddOutputFilterByType is enabled)

I have added the following line in my Apache httpd.conf: - AddOutputFilterByType DEFLATE text/html text/css application/javascript application/x-javascript application/json I have a html file (test.html) with a script inclusion: -
Sabya
  • 10,244
  • 16
  • 62
  • 90
26
votes
6 answers

how to check mod_deflate is enabled in apache?

Is there a command line command that can tell whether or not mod deflate is running on Apache?
omg
  • 123,990
  • 135
  • 275
  • 341
20
votes
1 answer

Difference between mod_deflate and zlib output_compression

Can anyone tell me the difference between using mod_deflate and zlib output_compression? I understand that zlib is done in PHP and mod_deflate is done in Apace, my .htaccess file looks like: php_flag zlib.output_compression On or: SetOutputFilter…
fire
  • 20,449
  • 16
  • 73
  • 109
17
votes
3 answers

Why I should not compress images in HTTP headers?

I read some articles about HTTP headers compression. Today I installed YSlow and it recommends that I compress the resources (text/html, javascript, css and images). Now I'm reading the documentation for Apache mod_deflate but in the example don't…
Agusti-N
  • 3,902
  • 10
  • 37
  • 45
14
votes
3 answers

How to disable mod_deflate in apache2?

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?
wakandan
  • 965
  • 4
  • 15
  • 26
13
votes
3 answers

Randomly appearing gzip headers

I have a long running script in a shared hosting environment that outputs a bunch of XML Sometimes (only sometimes) a random GZIP header will appear in my output, and the output will be terminated. For instance 0000000: 3c44 4553 435f 4c4f 4e47 3e3c…
Kristoffer Sall-Storgaard
  • 10,156
  • 5
  • 32
  • 46
11
votes
1 answer

How to configure mod_deflate to serve gzipped assets prepared with assets:precompile

When running the assets:precompile rake task, gzipped versions of your app's assets are created. According to the Rails guide for the asset pipeline, you can configure your web server (in my case Apache 2.2) to serve these precompressed files…
jrosw
  • 133
  • 1
  • 5
11
votes
2 answers

Apache httpd 2.4 reverse proxy does not compress

With Apache httpd 2.2, it was possible to setup a reverse proxy and use mod_deflate for compressing proxied content, honoring Accept-Encoding: gzip headers. This configuration was sufficient for getting it to work: LoadModule deflate_module…
Gunther
  • 4,851
  • 1
  • 20
  • 33
9
votes
4 answers

mod_deflate vs Django GZipMiddleware, which one to use for deployment?

We're deploying Django apps with Apache 2.2 + mod_wsgi. Should we enable mod_deflate in Apache or use Django's GZipMiddleware? Which option performs better?
Imran
  • 76,055
  • 23
  • 93
  • 124
8
votes
5 answers

Prevent mod_deflate on zip file served by PHP

I'm having some trouble prevent mod_deflate from jumping in on this scenario: user running CodeIgniter (or any other framework that re-directs to index.php) mod_deflate is active zip file is served by a CodeIgniter controller (headers +…
Frankie
  • 23,189
  • 10
  • 74
  • 112
7
votes
1 answer

Apache mod_deflate not compressing json output

I've followed all the steps in multiple tutorials to enable mod_deflate in Apache but I'm still not seeing compression (in Fiddler) when I issue requests for json (via PHP script) to my local web server. Compression isn't necessary for my browser to…
tomfumb
  • 3,371
  • 2
  • 29
  • 43
7
votes
2 answers

Can I tell mod_deflate & PHP to skip compression on one directory only?

To compress all my web page, I use this .htaccess code. It uses Apache deflate module if possible, else apply the PHP ob_gzhandler compression. Everything is working fine, but for specific reason, I don't want to apply the compression for the folder…
sdespont
  • 13,371
  • 7
  • 52
  • 89
1
2 3
10 11