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
#section.io VCL sample. Copy paste into your section.io account to implement instantly | |
#vcl_recv - copy this code into the section called sub vcl_recv | |
if (req.url ~ ".*\.(?:css|js|jpe?g|png|gif|ico|swf)(?=\?|&|$)") { | |
unset req.http.Cookie; | |
#Varnish <= 3.x calls this "return (lookup);" | |
return (hash); | |
} | |
#vcl_backend_response - copy this code into the section called sub vcl_backend_response |
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
#section.io VCL sample. Copy paste into your section.io account to implement instantly | |
#vcl_recv - copy this code into the section called sub vcl_recv | |
if (req.http.Accept-Encoding) { | |
if (req.http.Accept-Encoding ~ "gzip") { | |
set req.http.Accept-Encoding = "gzip"; | |
} else if (req.http.Accept-Encoding ~ "deflate") { | |
set req.http.Accept-Encoding = "deflate"; | |
} else { | |
unset req.http.Accept-Encoding; |
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
#section.io VCL sample. Copy paste into your section.io account to implement instantly | |
#vcl_recv - copy this code into the section called sub vcl_recv | |
if (req.url ~ ".*\.(?:css|js|jpe?g|png|gif|ico|swf)(?=\?|&|$)") { | |
unset req.http.Cookie; | |
#Varnish <= 3.x calls this "return (lookup);" instead of "return (hash);" | |
return (hash); | |
} | |
#vcl_backend_response - copy this code into the section called sub vcl_backend_response |
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
sub vcl_deliver { | |
if (obj.hits > 0) { | |
set resp.http.X-Cache = "HIT"; | |
} else { | |
set resp.http.X-Cache = "MISS"; | |
} | |
} |
NewerOlder