Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

How can I test if a cookie starts with SESS* in the Varnish config file. I want all requests to hit the server if this cookie is set. Is it a regular regex?

share|improve this question
up vote 1 down vote accepted

Yeah, just use a regex in vcl_recv. Something like:

if (req.http.Cookie ~ "(^|;\s*)SESS") {
share|improve this answer
I already have something like: if (req.http.Cookie ~ "(VARNISH|DRUPAL_UID)") { return (pass); }. Should I just add this afterwards? – Eduard Luca Jul 25 '12 at 21:11
Yeah that'll work. – Pax Jul 26 '12 at 13:58

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.