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

kAja Ziegler ziegleka at gmail.com
Thu Sep 21 13:16:04 UTC 2017


>
> There is no >60 need on the 301. Just me suggesting that 60sec is too
> short caching time for a _permanent_ thing.


There is - may be some misconfiguration in my squid.conf.

If I set max-age to values from interval <1;60> only 302 and 307 redirects
were cached (HIT) and no 301. When I increased the max-age value to 61 then
the 301 redirect was cached too.


But you are right, that the cause of no-caching the 301 redirect is the min
value of:

refresh_pattern .		0	20%	4320

But for redirects 302 and 307 the above-mentioned refresh_pattern is ignored.


My source server is Apache and the corresponding configuration is:

RewriteRule /img301.jpg /img.svg [R=301,L,E=rcache:1]

RewriteRule /img302.jpg /img.svg [R=302,L,E=rcache:1]
RewriteRule /img307.jpg /img.svg [R=307,L,E=rcache:1]

Header always set Cache-Control "max-age=3" env=rcache

zigi

On Thu, Sep 21, 2017 at 2:24 PM, Amos Jeffries <squid3 at treenet.co.nz> wrote:

> On 21/09/17 22:16, kAja Ziegler wrote:
>
>>     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"
>>
>>
> There is no >60 need on the 301. Just me suggesting that 60sec is too
> short caching time for a _permanent_ thing.
>
> 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.
>>
>
> It should be, so long as it is fresh so that means it does depend on
> refresh_pattern saying it is fresh when no controls are present.
>
> 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/0d759f92/attachment.html>


More information about the squid-users mailing list