[PATCH] Upstream: fix the cache duration calculation

Florent Le Coz florent.lecoz at smartjog.com
Fri Nov 15 16:53:42 UTC 2013

On 11/15/2013 05:44 PM, Maxim Dounin wrote:
>> I’ve set the priorities as: X-Accel-Expires > Cache-Control > Expires.
>> I’m not sure about what the priority of X-Accel-Expires should be
>> (but the last two are well defined in the RFC as you correctly
>> pointed in a previous message).
> That's certainly looks like an overkill.  At most, we need just
> one bit to disambiguate the Cache-Control header processing, as it
> needs to know whether valid_sec was set by X-Accel-Expires (and
> then it shouldn't do anything) or by Expires (and then it's
> expected to override the value set).

In my next patch (using the Age header), we need to know if that value 
was set by Cache-Control (and not by Expires or X-Accel-Expires), 
because that’s the only case in which the valid_sec value should be 
That would require a new bit to store this information.

> (A side note: we might also want to do something with u->cacheable
> set to 0 by Expires.  The Expires header is expected to be
> overriden by Cache-Control, but it doesn't happen if an Expires
> header contained a date in the past and u->cacheable was set to 0
> due to it.)


Florent Le Coz

More information about the nginx-devel mailing list