Last active
December 14, 2015 23:59
-
-
Save tlowrimore/5169993 to your computer and use it in GitHub Desktop.
Apache config directives for serving Rails's precompiled .gz files, created by the asset pipeline during precompile.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<LocationMatch "^/assets/.*$"> | |
Header unset ETag | |
FileETag None | |
# RFC says only cache for 1 year | |
ExpiresActive On | |
ExpiresDefault "access plus 1 year" | |
RewriteEngine On | |
RewriteCond %{HTTP:Accept-Encoding} gzip | |
RewriteCond %{HTTP_USER_AGENT} !Konqueror | |
RewriteCond %{REQUEST_FILENAME}.gz -f | |
RewriteRule ^(.+).(css|js)$ $1.$2.gz [QSA,L] | |
</LocationMatch> | |
<FilesMatch \.css\.gz> | |
ForceType text/css | |
</FilesMatch> | |
<FilesMatch \.js\.gz> | |
ForceType application/javascript | |
</FilesMatch> | |
AddEncoding gzip .gz |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment