How to configure mod_deflate to serve gzipped assets prepared with assets:precompile
First, you don't want mod_deflate to operate here. So in your assets .htaccess file add:
SetEnv no-gzip
This should turn off mod_deflate for your assets.
Second, I hate to disagree with the rails folks, but I think there are a couple deficiencies in their assets .htaccess recipe. The top part is fine but for RewriteEngine and beyond I'd have:
RewriteEngine on# Make sure the browser supports gzip encoding before we send itRewriteCond %{HTTP:Accept-Encoding} \b(x-)?gzip\bRewriteCond %{REQUEST_URI} .*\.(css|js)RewriteCond %{REQUEST_FILENAME}.gz -sRewriteRule ^(.+) $1.gz [L]# without it, Content-Type will be "application/x-gzip"# also add a content-encoding header to tell the browser to decompress<FilesMatch \.css\.gz$> ForceType text/css Header set Content-Encoding gzip</FilesMatch><FilesMatch \.js\.gz$> ForceType application/javascript Header set Content-Encoding gzip</FilesMatch>