Question

I have the following VCL:

sub jamie_fetch
{
    if(beresp.http.X-Var-Cache == "YES") {
        unset beresp.http.Set-Cookie;
        set beresp.http.X-Cacheable = "YES";
        set beresp.grace = 365d;
        set beresp.ttl = 365d;

        return(deliver);
    }

    set beresp.http.X-Cacheable = "NO";

    return(hit_for_pass);
}

I know it partly works because I get the following header when I first visit the page:

X-Cacheable:YES

However I also get:

Set-Cookie:foobar

I am assuming I have made a mistake in the following:

unset beresp.http.Set-Cookie;

But from my searching that seems to be correct? I'd be grateful if someone with more experience can point me in the right direction.

Thanks in advance for any help/tips/pointers :-)

Was it helpful?

Solution

You should lower-case header names when using unset:

unset beresp.http.set-cookie;
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top