httpd-docs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Rainer Jung <rainer.j...@kippdata.de>
Subject Re: svn commit: r1673470 - /httpd/httpd/trunk/docs/manual/mod/mod_deflate.xml
Date Tue, 14 Apr 2015 22:14:50 GMT
Am 14.04.2015 um 19:06 schrieb rbowen@apache.org:
> Author: rbowen
> Date: Tue Apr 14 17:06:10 2015
> New Revision: 1673470
>
> URL: http://svn.apache.org/r1673470
> Log:
> Add "pre-compressed content" recipe, as per
> https://bz.apache.org/bugzilla/show_bug.cgi?id=51336
>
> Modified:
>      httpd/httpd/trunk/docs/manual/mod/mod_deflate.xml
>
> Modified: httpd/httpd/trunk/docs/manual/mod/mod_deflate.xml
> URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/docs/manual/mod/mod_deflate.xml?rev=1673470&r1=1673469&r2=1673470&view=diff
> ==============================================================================
> --- httpd/httpd/trunk/docs/manual/mod/mod_deflate.xml (original)
> +++ httpd/httpd/trunk/docs/manual/mod/mod_deflate.xml Tue Apr 14 17:06:10 2015
> @@ -178,6 +178,51 @@ SetEnvIfNoCase Request_URI \.(?:gif|jpe?
>       </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">
> +  &lt;IfModule mod_headers.c&gt;
> +    # 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]
> +
> +
> +    &lt;FilesMatch "(\.js\.gz|\.css\.gz)$"&gt;
> +      # Serve correct encoding type.
> +      Header append Content-Encoding gzip
> +
> +      # Force proxies to cache gzipped &amp;
> +      # non-gzipped css/js files separately.
> +      Header append Vary Accept-Encoding
> +    &lt;/FilesMatch&gt;
> +  &lt;/IfModule&gt;
> +</IfModule>
> +
> +
> +    </highlight>
> +
> +</section>
> +
>   <directivesynopsis>
>   <name>DeflateFilterNote</name>
>   <description>Places the compression ratio in a note for logging</description>

AFAIK mod_rewrite automatically adds headers from RewriteCond to the 
Vary header as long as no "NV" flag is used. So the "Header append Vary 
Accept-Encoding" part should not be necessary.

Thanks for putting effort into documenting the recipe.

Regards,

Rainer

---------------------------------------------------------------------
To unsubscribe, e-mail: docs-unsubscribe@httpd.apache.org
For additional commands, e-mail: docs-help@httpd.apache.org


Mime
View raw message