Instantly share code, notes, and snippets.

Embed
What would you like to do?
section.io ISE template (for Magento)
# 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