Created
December 15, 2017 04:59
-
-
Save section-io-gists/13df1af6d7c600e02eeca3196549bda4 to your computer and use it in GitHub Desktop.
Increase browser cache TTL in Varnish VCL 4.0
This file contains hidden or 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
# Cache statics | |
if ((bereq.url ~ "\.(css)(?=\?|&|$)" && beresp.http.Content-Type ~ "text/css") | |
|| (bereq.url ~ "\.(jpe?g|png|gif|ico)(?=\?|&|$)" && beresp.http.Content-Type ~ "image/") | |
|| (bereq.url ~ "\.(js)(?=\?|&|$)" && beresp.http.Content-Type ~ "javascript") | |
|| (bereq.url ~ "\.(swf)(?=\?|&|$)" && beresp.http.Content-Type ~ "application/x-shockwave-flash") | |
|| (bereq.url ~ "\.(woff)(?=\?|&|$)" && beresp.http.Content-Type ~ "font")) { | |
set beresp.http.Cache-Control = "public, max-age=604800" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment