Last active
September 23, 2015 04:42
-
-
Save section-io-gists/4f72106713b9024a4272 to your computer and use it in GitHub Desktop.
section.io ISE template (for Magento)
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
# This is a basic VCL configuration file for varnish. See the vcl(7) | |
# man page for details on VCL syntax and semantics. | |
# | |
# Default backend definition. Set this to point to your content | |
# server. | |
# | |
backend default { | |
.host = "next-hop"; | |
.port = "80"; | |
.first_byte_timeout = 300s; | |
.between_bytes_timeout = 300s; | |
} | |
import std; | |
sub vcl_recv { | |
} | |
sub vcl_pipe { | |
} | |
sub vcl_hash { | |
if (req.http.Cookie ~ "frontend" || req.url ~ "/admin/") { | |
hash_data("has_unique_cookie"); | |
} else { | |
hash_data("no_unique_cookie"); | |
} | |
} | |
sub vcl_hit { | |
} | |
sub vcl_fetch { | |
if (beresp.status < 400) { | |
if (beresp.http.Content-Type ~ "text/html") { | |
if (req.http.Cookie !~ "frontend" && req.url !~ "/admin/") { | |
remove beresp.http.Set-Cookie; | |
set beresp.ttl = 300s; | |
set beresp.grace = 120m; | |
return(deliver); | |
} else { | |
std.log("passreason:ise-deactivated"); | |
set beresp.ttl = 120s; | |
return (hit_for_pass); | |
} | |
} #Close out section dealing with text/html | |
} else { | |
#Section added to cater for 404 response cutting out of ISE early | |
if (req.http.Cookie !~ "frontend") { | |
std.log("passreason:ise-status-400-up"); | |
remove beresp.http.Set-Cookie; | |
return (hit_for_pass); | |
} | |
} | |
} | |
sub vcl_deliver { | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment