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

kAja Ziegler ziegleka at gmail.com
Thu Sep 21 08:36:08 UTC 2017


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

> GET /img301.jpg HTTP/1.1
> Host: 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/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.


I use Squid 3.4.14 from CentOS 6 package squid34-3.4.14-15.el6.x86_64.

With best regards,

zigi

On Tue, Sep 19, 2017 at 5:17 PM, Amos Jeffries <squid3 at treenet.co.nz> wrote:

> On 20/09/17 02:00, kAja Ziegler wrote:
>
>> Hi all,
>>
>>    I want to ask why my Squid does not cache redirects 301, 302 and 307.
>> See anomised example below. Even if I call the URL more times or I open it
>> in the browser, I always get MISS independently of the return code 301, 302
>> or 307.
>>
>
> 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.
>
> 301 should be cached unless the object would need revalidation immediately.
>
>
> 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/d19ba236/attachment.html>


More information about the squid-users mailing list