Last active
May 12, 2017 05:23
-
-
Save section-io-gists/0d94e69942703cd1c8991517c357f545 to your computer and use it in GitHub Desktop.
Varnish 4 - Strip browser side tracking script to improve cache hit rate
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 { | |
# Strip browser side tracking script to improve cache hit rate | |
if (req.url ~ "[?&](utm_source|utm_medium|utm_campaign|gclid|cx|ie|cof|siteurl|mc_cid|mc_eid)=") { | |
set req.url = regsuball(req.url, "(?:(\?)?|&)(?:utm_source|utm_medium|utm_campaign|gclid|cx|ie|cof|siteurl|mc_cid|mc_eid)=[^&]+", "\1"); | |
set req.url = regsuball(req.url, "(?:(\?)&|\?$)", "\1"); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment