How to test if cookie contains pattern VCL (Varnish)

cookiesvarnish

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?

Best Answer

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

if (req.http.Cookie ~ "(^|;\s*)SESS") {
    return(pass);
}