Skip to content

Instantly share code, notes, and snippets.

@russellsimpkins
Last active August 22, 2016 18:52
Show Gist options
  • Save russellsimpkins/d17da871948e6cec28613ff9cbb29c89 to your computer and use it in GitHub Desktop.
Save russellsimpkins/d17da871948e6cec28613ff9cbb29c89 to your computer and use it in GitHub Desktop.
sub vcl_recv {
// remove jquery cache buster query parameter if it exists
if (req.url ~ "_=[0-9]+") {
set req.http.clean = regsuball(req.url, "(_=[0-9]+)", "");
set req.http.clean = regsub(req.http.clean, "\?&", "?");
set req.http.clean = regsub(req.http.clean, "&&", "&");
set req.http.clean = regsub(req.http.clean, "&$", "");
set req.http.clean = regsub(req.http.clean, "\?$", "");
// modify the url with the clean version
set req.url = req.http.clean;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment