Last active
March 21, 2017 16:17
-
-
Save razvanphp/8ddaeca0968163442ba03a8d0369a53b to your computer and use it in GitHub Desktop.
normalize request params & strip cookies in varnish
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 { | |
# Happens before we check if we have this in cache already. | |
# | |
# Typically you clean up the request here, removing cookies you | |
# don't need, rewriting the request, etc. | |
if ((req.url ~ "^/$" || | |
req.url ~ "^/(frauen|maenner|kinder|outlet|marke)(/.+)?" || | |
req.url ~ "^/api/(seen2bought/|similarProduct/|product\?)" || | |
req.url ~ "\.(css|js)\?.*" || | |
req.url ~ "\.(png|gif|jpg|ico|js|css|xml|pdf|woff|ttf)$" || | |
) && req.method == "GET") { | |
# Normalize the query parameters | |
set req.url = std.querysort(req.url); | |
# Strip the cookies | |
unset req.http.cookie; | |
return(hash); | |
} else { | |
return(pass); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment