diff options
Diffstat (limited to 'docs')
-rw-r--r-- | docs/manual/mod/mod_deflate.xml | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/docs/manual/mod/mod_deflate.xml b/docs/manual/mod/mod_deflate.xml index afa4ca33ef..847210f458 100644 --- a/docs/manual/mod/mod_deflate.xml +++ b/docs/manual/mod/mod_deflate.xml @@ -178,6 +178,51 @@ SetEnvIfNoCase Request_URI \.(?:gif|jpe?g|png)$ no-gzip </example> </section> +<section id="precompressed"><title>Serving pre-compressed +content</title> + + <p>Since <module>mod_deflate</module> re-compresses content each + time a request is made, some performance benefit can be derived by + pre-compressing the content and telling mod_deflate to serve them + without re-compressing them. This may be accomplished using a + configuration like the following:</p> + + <highlight language="config"> + <IfModule mod_headers.c> + # Serve gzip compressed CSS files if they exist + # and the client accepts gzip. + RewriteCond %{HTTP:Accept-encoding} gzip + RewriteCond %{REQUEST_FILENAME}\.gz -s + RewriteRule ^(.*)\.css $1\.css\.gz [QSA] + + # Serve gzip compressed JS files if they exist + # and the client accepts gzip. + RewriteCond %{HTTP:Accept-encoding} gzip + RewriteCond %{REQUEST_FILENAME}\.gz -s + RewriteRule ^(.*)\.js $1\.js\.gz [QSA] + + + # Serve correct content types, and prevent mod_deflate double gzip. + RewriteRule \.css\.gz$ - [T=text/css,E=no-gzip:1] + RewriteRule \.js\.gz$ - [T=text/javascript,E=no-gzip:1] + + + <FilesMatch "(\.js\.gz|\.css\.gz)$"> + # Serve correct encoding type. + Header append Content-Encoding gzip + + # Force proxies to cache gzipped & + # non-gzipped css/js files separately. + Header append Vary Accept-Encoding + </FilesMatch> + </IfModule> +</IfModule> + + + </highlight> + +</section> + <directivesynopsis> <name>DeflateFilterNote</name> <description>Places the compression ratio in a note for logging</description> |