Skip to content

Instantly share code, notes, and snippets.

@reinink
Last active February 16, 2022 03:12
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save reinink/620a1e65f2be41c96cc8 to your computer and use it in GitHub Desktop.
Save reinink/620a1e65f2be41c96cc8 to your computer and use it in GitHub Desktop.
Nginx Filename Based Cache Busting
location ~* '\.(?:jpg|jpeg|gif|png|ico|gz|svg|svgz|mp4|ogg|ogv|webm|htc|css|js|ttf|ttc|otf|eot|woff)$'
{
expires 1y;
add_header Cache-Control "public";
add_header "Cache-Control" "no-transform";
location ~* '(.+)\.(?:\d+)\.(js|css|png|jpg|jpeg|gif)$'
{
try_files $uri $1.$2;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment