varnish eating (unset'ing) the Cookie?

Jason Price japrice at gmail.com
Mon Oct 26 20:12:04 CET 2015


varnish version 3.0.7 (Yes, I know it's EOL. Hopefully we can get to
varnish4 this quarter)
OS: Centos 7.1
No VMODs other than std.

Varnish is receiving a set cookie, verified by seeing "RxHeader c Cookie"
in varnishlog.  However, looking at "req.http.Cookie" in vcl_recv shows it
as non-existent.

Any ideas?

Relevant VCL:


sub vcl_recv {
        std.log("entry point cookie is " + req.http.Cookie);
        std.log("entry point user agent is " + req.http.User-Agent);

        if (req.url == "/heartbeat") {
                error 200 "OK";
        }

        std.syslog(1, req.url + " checking greencookie");
        call validate_greencookie;

        if (req.restarts == 0) {
                if (req.http.x-forwarded-for) {
                        set req.http.X-Forwarded-For =
                        req.http.X-Forwarded-For + ", " + client.ip;
                } else {
                        set req.http.X-Forwarded-For = client.ip;
                }
        }

        call set_backend;

        return (pass); #router never looksup
}

sub validate_greencookie {

        # only the akamai cookie shall pass
        std.log("cookie is " + req.http.Cookie);
        if (req.http.Cookie ~ "^.*[REDACTED_COOKIE]" ) {
        }
        else {
                error 401 "Unauthorized";
        }
}


Relevant VarnishLog output:


    4 SessionOpen  c 10.255.196.4 59771 :8080
    4 ReqStart     c 10.255.196.4 59771 1143318669
    4 RxRequest    c GET
    4 RxURL        c [NOT RELEVANT]
    4 RxProtocol   c HTTP/1.1
    4 RxHeader     c Host: [NOT RELEVANT]
    4 RxHeader     c User-Agent: curl/7.43.0
    4 RxHeader     c Accept: */*
    4 RxHeader     c Cookie : [REDACTED_COOKIE]
    4 VCL_call     c recv
    4 VCL_Log      c entry point cookie is
    4 VCL_Log      c entry point user agent is curl/7.43.0
    4 VCL_Log      c cookie is
    4 VCL_return   c error
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.varnish-cache.org/lists/pipermail/varnish-misc/attachments/20151026/c8bc96c0/attachment.html>


More information about the varnish-misc mailing list