Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to configure mod_deflate to serve gzipped assets prepared with assets:precompile
    text
    copied!<p>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 instead of having the web server do the work.</p> <p>What I can't figure out is how to get mod_deflate configured so that these files are served instead of being double-compressed and then served?</p> <p>I have mod_deflate enabled via httpd.conf:</p> <pre><code>AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css text/javascript BrowserMatch ^Mozilla/4 gzip-only-text/html BrowserMatch ^Mozilla/4\.0[678] no-gzip BrowserMatch \bMSIE !no-gzip !gzip-only-text/html </code></pre> <p>And I've converted the code on the rails guide to go into the .htaccess in public/assets:</p> <pre><code># Some browsers still send conditional-GET requests if there's a # Last-Modified header or an ETag header even if they haven't # reached the expiry date sent in the Expires header. Header unset Last-Modified Header unset ETag FileETag None # RFC says only cache for 1 year ExpiresActive On ExpiresDefault "access plus 1 year" # Serve gzipped versions instead of requiring Apache to do the work RewriteEngine on RewriteCond %{REQUEST_FILENAME}.gz -s RewriteRule ^(.+) $1.gz [L] # without it, Content-Type will be "application/x-gzip" &lt;FilesMatch .*\.css.gz&gt; ForceType text/css &lt;/FilesMatch&gt; &lt;FilesMatch .*\.js.gz&gt; ForceType text/javascript &lt;/FilesMatch&gt; </code></pre> <p>Any ideas how to set this up properly?</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload