Last active
February 16, 2022 03:12
-
-
Save reinink/620a1e65f2be41c96cc8 to your computer and use it in GitHub Desktop.
Nginx Filename Based Cache Busting
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
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