httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rbo...@apache.org
Subject svn commit: r1673473 - in /httpd/httpd/branches/2.4.x/docs/manual/mod: mod_deflate.html.en mod_deflate.xml
Date Tue, 14 Apr 2015 17:18:59 GMT
Author: rbowen
Date: Tue Apr 14 17:18:59 2015
New Revision: 1673473

URL: http://svn.apache.org/r1673473
Log:
Add "pre-compressed content" reccipe, as per
https://bz.apache.org/bugzilla/show_bug.cgi?id=51336

Modified:
    httpd/httpd/branches/2.4.x/docs/manual/mod/mod_deflate.html.en
    httpd/httpd/branches/2.4.x/docs/manual/mod/mod_deflate.xml

Modified: httpd/httpd/branches/2.4.x/docs/manual/mod/mod_deflate.html.en
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.4.x/docs/manual/mod/mod_deflate.html.en?rev=1673473&r1=1673472&r2=1673473&view=diff
==============================================================================
--- httpd/httpd/branches/2.4.x/docs/manual/mod/mod_deflate.html.en (original)
+++ httpd/httpd/branches/2.4.x/docs/manual/mod/mod_deflate.html.en Tue Apr 14 17:18:59 2015
@@ -57,6 +57,8 @@ client</td></tr>
 <li><img alt="" src="../images/down.gif" /> <a href="#recommended">Sample
Configurations</a></li>
 <li><img alt="" src="../images/down.gif" /> <a href="#enable">Enabling
Compression</a></li>
 <li><img alt="" src="../images/down.gif" /> <a href="#proxies">Dealing
with proxy servers</a></li>
+<li><img alt="" src="../images/down.gif" /> <a href="#precompressed">Serving
pre-compressed
+content</a></li>
 </ul><h3>See also</h3>
 <ul class="seealso">
 <li><a href="../filter.html">Filters</a></li>
@@ -185,6 +187,47 @@ SetEnvIfNoCase Request_URI \.(?:gif|jpe?
 
     <div class="example"><h3>Example</h3><pre class="prettyprint lang-config">Header
set Vary *</pre>
 </div>
+</div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif"
/></a></div>
+<div class="section">
+<h2><a name="precompressed" id="precompressed">Serving pre-compressed
+content</a></h2>
+
+    <p>Since <code class="module"><a href="../mod/mod_deflate.html">mod_deflate</a></code>
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>
+
+    <pre class="prettyprint lang-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;</pre>
+
+
 </div>
 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif"
/></a></div>
 <div class="directive-section"><h2><a name="DeflateBufferSize" id="DeflateBufferSize">DeflateBufferSize</a>
<a name="deflatebuffersize" id="deflatebuffersize">Directive</a></h2>

Modified: httpd/httpd/branches/2.4.x/docs/manual/mod/mod_deflate.xml
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.4.x/docs/manual/mod/mod_deflate.xml?rev=1673473&r1=1673472&r2=1673473&view=diff
==============================================================================
--- httpd/httpd/branches/2.4.x/docs/manual/mod/mod_deflate.xml (original)
+++ httpd/httpd/branches/2.4.x/docs/manual/mod/mod_deflate.xml Tue Apr 14 17:18:59 2015
@@ -178,6 +178,48 @@ 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;
+    </highlight>
+
+</section>
+
 <directivesynopsis>
 <name>DeflateFilterNote</name>
 <description>Places the compression ratio in a note for logging</description>



Mime
View raw message