[squid-users] cache-control: no-cache="set-cookie" prevents caching

Sriram Devadas sdevadas at vistaprint.com
Tue Apr 14 21:49:19 UTC 2015


Squid version 3.5.3.
When the http response received by Squid contains a no-cache="set-cookie", the response is not cached. cache.log has the line:
2015/04/14 18:24:38.027 kid1| http.cc(359) cacheableReply: NO because server reply Cache-Control:no-cache has parameters

The relevant source code is in http.cc:
        if (rep->cache_control && rep->cache_control->hasNoCache() && rep->cache_control->noCache().size() > 0) {
            /* TODO: we are allowed to cache when no-cache= has parameters.
             * Provided we strip away any of the listed headers unless they are revalidated
             * successfully (ie, must revalidate AND these headers are prohibited on stale replies).
             * That is a bit tricky for squid right now so we avoid caching entirely.
             */
            debugs(22, 3, HERE << "NO because server reply Cache-Control:no-cache has parameters");
            return 0;
        }

I have read the TODO comment but do not know if this applies to the set-cookie parameter too.
Is it okay to add a condition here not to return if the cache-control header contains only no-cache="set-cookie"?
In client_side_reply.cc the no-cache="set-cookie" seems to be handled correctly, the set-cookie header is removed in the response, which I am guessing removes this header correctly in the response:
    if (is_hit)
        hdr->delById(HDR_SET_COOKIE);

Thanks,
sdevadas



More information about the squid-users mailing list