Last active
July 20, 2018 13:57
-
-
Save rezan/ec1fe99c27b761e16b1d0bf8e4822828 to your computer and use it in GitHub Desktop.
hit_miss.vcl for Varnish 6.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
| # hit_miss.vcl for Varnish 6.0 | |
| vcl 4.0; | |
| # What are we, hit, miss, or pass? | |
| sub vcl_recv { | |
| set req.http.X-status = "NONE"; | |
| } | |
| sub vcl_hit { | |
| set req.http.X-status = "HIT"; | |
| } | |
| sub vcl_miss { | |
| set req.http.X-status = "MISS"; | |
| } | |
| sub vcl_pass { | |
| set req.http.X-status = "PASS"; | |
| } | |
| sub vcl_deliver { | |
| # Cache status | |
| set resp.http.X-cache = obj.hits + " (" + req.http.X-status + ":" + | |
| server.identity + ") " + resp.http.X-cache; | |
| # Other stats | |
| set resp.http.X-hits = std.integer(resp.http.X-hits, 0) + obj.hits; | |
| set resp.http.X-ttl = obj.ttl; | |
| set resp.http.X-grace = obj.grace; | |
| set resp.http.X-keep = obj.keep; | |
| set resp.http.X-uncacheable = obj.uncacheable; | |
| } | |
| sub vcl_synth { | |
| # Cache status | |
| set resp.http.X-cache = "(SYNTH:" + server.identity + ")"; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment