Skip to content

Instantly share code, notes, and snippets.

@kesor
Last active December 19, 2015 12:19
Show Gist options
  • Save kesor/5953739 to your computer and use it in GitHub Desktop.
Save kesor/5953739 to your computer and use it in GitHub Desktop.
backend default {
.host = "127.0.0.1";
.port = "8080";
}
sub vcl_recv {
if (req.request == "POST") {
return (pipe);
}
if (req.url ~ "^/(s/|favicon.ico|download/resources/|download/batch/|images/icons/)") {
set req.http.X-Static = "yes";
remove req.http.User-Agent;
remove req.http.Cookie;
remove req.http.Referer;
return (lookup);
}
return (pass);
}
sub vcl_fetch {
if (req.http.X-Statis == "yes") {
remove beresp.http.Set-Cookie;
}
return (deliver);
}
sub vcl_hash {
set req.url = regsub(req.url, "[?&]_=\d+", "");
set req.url = regsub(req.url, "^/s/en_US.[^-]*-", "/s/en_US-x-");
hash_data(req.url);
return (hash);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment