Created
October 12, 2017 06:20
-
-
Save section-io-gists/498240d335be9013139c7f329cfbfa60 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_recv { | |
if (req.request != "GET" && req.request != "HEAD" && req.request != "PURGE") { | |
return (pass); | |
} | |
// Rest of vcl_recv code | |
return(lookup); | |
} | |
sub vcl_fetch { | |
if (req.request != "GET" && req.request != "HEAD" && req.request != "PURGE") { | |
set beresp.ttl = 120s; | |
return (hit_for_pass); | |
} | |
if (beresp.http.Content-Type ~ "text/html" && beresp.status < 400) { | |
if (bereq.http.Cookie !~ "ASP.NET_SessionId" && bereq.url !~ "(/[Cc]art|/[Cc]heckout|/[Aa]dmin|/[Ll]ogin|/[Aa]ccount)") { | |
unset beresp.http.Set-Cookie; | |
set beresp.ttl = 6h; | |
set beresp.grace = 12h; | |
} else { | |
set beresp.ttl = 120s; | |
return (hit_for_pass); | |
} | |
return (deliver); | |
} | |
} | |
sub vcl_hash { | |
if (req.http.Cookie !~ "ASP.NET_SessionId" && req.url !~ "(/[Cc]art|/[Cc]heckout|/[Aa]dmin|/[Ll]ogin|/[Aa]ccount)") { | |
hash_data("no_unique_cookie"); | |
} else { | |
hash_data("has_unique_cookie"); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment