Skip to content

Instantly share code, notes, and snippets.

@osulyanov
Forked from barek2k2/gist:5520967
Created January 25, 2014 14:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save osulyanov/8617046 to your computer and use it in GitHub Desktop.
Save osulyanov/8617046 to your computer and use it in GitHub Desktop.
Apache an nginx configuration for browser cache for static resources
For Apache, use the Location directive into your virtual host(be sure you have included expires and headers modules)
<LocationMatch "^/assets/.*$">
Header unset ETag
FileETag None
ExpiresActive On
ExpiresDefault "access plus 30 days"
</LocationMatch>
For nginx
location ~ ^/assets/ {
expires 30d;
add_header Cache-Control public;
add_header ETag "";
break;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment