[Patch] proxy cache for 304 Not Modified

MagicBear magicbearmo at gmail.com
Thu Sep 22 22:06:54 UTC 2011


May be this make a config for user to choose accept copy to compliant
with RFC2616?

2011/9/23 Woon Wai Keen <doubleukay at doubleukay.com>:
> On 2011-09-19 6:47 PM, Maxim Dounin wrote:
>>
>> Additional question to consider: what should happen if original
>> 200 reply comes with "Cache-Control: max-age=<seconds>" (or
>> "Expires:<time>").  Should we use it?  Or should we use another
>> one from 304 reply?
>>
>> Please provide rationale based on RFC2616.
>
> I'm most interested in this point you raised.
>
> Excerpt from RFC2616 13.5.3 (snipped only the relevant parts):
>>
>>   If the status code is 304 (Not Modified), the cache uses the entity-
>>   body stored in the cache entry as the entity-body of this outgoing
>>   response.
>>
>>   The end-to-end headers stored in the cache entry are used for the
>>   constructed response, except that
>>
>>      - any end-to-end headers provided in the 304 or 206 response MUST
>>        replace the corresponding headers from the cache entry.
>
> Due to this, we need to read the cached headers, merge it with upstream
> headers, write the updated cache to a temp file and replace the existing
> one.
>
> To avoid the copy IO for some specific use cases where 304s won't have
> consequential header updates, it can be sufficient to just update valid_sec.
> Of course this would be highly uncompliant with RFC2616...
>
> _______________________________________________
> nginx-devel mailing list
> nginx-devel at nginx.org
> http://mailman.nginx.org/mailman/listinfo/nginx-devel
>



-- 
MagicBear



More information about the nginx-devel mailing list