Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Increase browser cache TTL in Varnish VCL 4.0
# 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