[squid-users] When the redirect [301, 302, 307] is cached by Squid?

kAja Ziegler ziegleka at gmail.com
Thu Sep 21 10:16:46 UTC 2017


>
> Thats what the "must-revalidate" means. It should work better with just
> max-age or Expires header - and with a longer value than 60 sec since this
> is supposed to be a *permanent* situation.


As I know "must-revalidate" mean "refuse to return stale responses to the
user even if they say that stale responses are acceptable" - cached object
must be revalidated.

Max-age=60 was only used for testing.

The results of my testing:

- redirect 302 or 307 - to be cached needs Cache-Control max-age > 0 or
Expires "access plus 1 seconds"
- redirect 301 - to be cached needs Cache-Control max-age > 60 or Expires
"access plus 61 seconds"

This is strange because I thought that 301 is always cached without
Cache-Control or Expires headers. And I can't find any information in the
documentation which describes such behaviour.

zigi

On Thu, Sep 21, 2017 at 11:11 AM, Amos Jeffries <squid3 at treenet.co.nz>
wrote:

> On 21/09/17 20:36, kAja Ziegler wrote:
>
>> Hi Amos,
>>
>>     302 and 307 are not because as their status description indicates
>>     they are *temporary* results. They can only be cached if there are
>>     explicit details from the server indicating for how long.
>>
>>
>> You were right. After I added header Cache-Control "max-age=60,
>> must-revalidate" to the redirects, then the response was cached. Thank you
>> for clarification.
>>
>>     301 should be cached unless the object would need revalidation
>>     immediately.
>>
>>
>> But for 301 I always get MISS - with and without a cache-control header:
>>
>> $ curl -v http:/test.example.com/img301.jpg <
>> http://test.example.com/img301.jpg>
>>
>> GET /img301.jpg HTTP/1.1
>>> Host: test.example.com <http://test.example.com>
>>> User-Agent: curl/7.50.1
>>> Accept: */*
>>>
>>> < HTTP/1.1 301 Moved Permanently
>> < Date: Thu, 21 Sep 2017 06:44:41 GMT
>> < Server: Apache
>> < Cache-Control: max-age=60, must-revalidate
>> < Location: http://test.example.com <http://test.example.com>/img.svg
>> < Content-Length: 247
>> < Content-Type: text/html; charset=iso-8859-1
>> < X-Cache: MISS from <squid-proxy>
>> < X-Cache-Lookup: MISS from <squid-proxy>:3128
>>
>> I can't find any information on Squid wiki or via Google if the object
>> need revalidation immediately.
>>
>
> Thats what the "must-revalidate" means. It should work better with just
> max-age or Expires header - and with a longer value than 60 sec since this
> is supposed to be a *permanent* situation.
>
>
> Amos
> _______________________________________________
> squid-users mailing list
> squid-users at lists.squid-cache.org
> http://lists.squid-cache.org/listinfo/squid-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squid-cache.org/pipermail/squid-users/attachments/20170921/f50002a3/attachment-0001.html>


More information about the squid-users mailing list