Skip to content

Instantly share code, notes, and snippets.

@owindsor
Created January 6, 2015 01:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save owindsor/21b289d480d931d457c3 to your computer and use it in GitHub Desktop.
Save owindsor/21b289d480d931d457c3 to your computer and use it in GitHub Desktop.
SilverStripe Varnish Cookie handling
# Remove all cookies that do not match the following rules
if (
# Any HTTP POST request
!(req.request == "POST") &&
# Admin URLs
!(req.url ~ "^/admin|Security/") &&
# Allow /dev/build and /dev/tasks URLs
!(req.url ~ "dev/build/") &&
!(req.url ~ "dev/tasks/") &&
# Staging/Previewing URLs while in /admin
!(req.http.referer ~ "\?stage=Stage$/") &&
!(req.http.referer ~ "\?stage=Live$/")
)
{
unset req.http.Cookie;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment