Skip to content

Instantly share code, notes, and snippets.

@promotion
Forked from owindsor/gist:21b289d480d931d457c3
Created January 1, 2016 00:25
Show Gist options
  • Save promotion/3cae0555b70917b8754c to your computer and use it in GitHub Desktop.
Save promotion/3cae0555b70917b8754c 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