Is there a way to determine if an ESI call came from cache or a backend?

I am trying to set a HTTP header on an ESI cache hit or miss, but am not having 
as much success as when checking for a non-ESI request.

In the recv, I set do_esi to true and the x-esi-request value, in deliver I 
have the code below which doesn't seem to work at all.  I don't see any 
X-ESI-Cache headers in varnishlog

In vcl_deliver:

if(obj.hits > 0){
        if(resp.http.x-esi-request == "Yes"){ set resp.http.X-ESI-Cache = 
"Cached"; }
        set resp.http.X-Cache = "Cached";
        set resp.http.X-Hits = obj.hits;
    } else {
        if(resp.http.x-esi-request == "Yes"){ set resp.http.X-ESI-Cache = 
"Fresh"; }
        set resp.http.X-Cache = "Fresh";
    }

    return (deliver);

Any assistance is appreciated.

Thanks,
Travis
_______________________________________________
varnish-misc mailing list
[email protected]
https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc

Reply via email to