Skip to content

Instantly share code, notes, and snippets.

@barek2k2
Last active December 17, 2015 00:29
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save barek2k2/5520967 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