Created
August 13, 2010 13:10
-
-
Save jberkel/522848 to your computer and use it in GitHub Desktop.
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
| sub vcl_fetch { | |
| # Enable grace period | |
| set beresp.grace = 1h; | |
| # Add X-Cacheable header to track cache miss reasons | |
| if (beresp.http.Set-Cookie) { | |
| set beresp.http.X-Cacheable = "NO:Set-Cookie"; | |
| } elseif (beresp.http.Pragma ~ "no-cache") { | |
| set beresp.http.X-Cacheable = "NO:Pragma=no-cache"; | |
| } elseif (beresp.http.Pragma ~ "no-store") { | |
| set beresp.http.X-Cacheable = "NO:Pragma=no-store"; | |
| } elseif (beresp.http.Cache-Control ~ "no-cache") { | |
| set beresp.http.X-Cacheable = "NO:Cache-Control=no-cache"; | |
| } elseif (beresp.http.Cache-Control ~ "max-age=0") { | |
| set beresp.http.X-Cacheable = "NO:Cache-Control=max-age=0"; | |
| } elseif (beresp.http.Cache-Control ~ "private") { | |
| set beresp.http.X-Cacheable = "NO:Cache-Control=private"; | |
| } elseif (!beresp.cacheable) { | |
| set beresp.http.X-Cacheable = "NO:Not Cacheable"; | |
| } else { | |
| set beresp.http.X-Cacheable = "YES"; | |
| return(deliver); | |
| } | |
| return(pass); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment