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

Amos Jeffries squid3 at treenet.co.nz
Thu Sep 21 09:11:31 UTC 2017


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


More information about the squid-users mailing list