[PATCH] Add 307 and 308 to default response codes for xxxxx_cache_valid.
mdounin at mdounin.ru
Mon Sep 24 16:25:21 UTC 2018
On Fri, Sep 21, 2018 at 06:35:52PM +0300, Gena Makhomed wrote:
> On 21.09.2018 15:58, Maxim Dounin wrote:
> >> Allow 1xx 2xx 3xx 4xx 5xx codes in xxxxx_cache_valid directives.
> >> For example, config fragment
> >> fastcgi_cache_valid 200 201 202 203 204 205 206 207 208 226 5m;
> >> fastcgi_cache_valid 300 301 302 303 304 305 306 307 308 10m;
> >> now can be rewritten as
> >> fastcgi_cache_valid 2xx 5m;
> >> fastcgi_cache_valid 3xx 10m;
> > I cannot say I like this change. Cacheability of various response
> > codes vary widely, and caching then "in bulk" in most cases is a
> > bad idea.
> > In particular, caching of 201 is always wrong as it is only
> > expected to be returned to non-cacheable POST and PUT requests.
> > Caching 206 is wrong unless you use "Ranges" in the cache key.
> > And caching 304 is wrong unless you've laso included
> > If-Modified-Since and If-None-Match headers in the cache key.
> > As such, I would rather refrain from introducing these shortcuts,
> > as they looks rather dangerous for the unwary.
> Ok, thank you for detailed explanation.
> What about adding 307 and 308 to list of default response codes?
I'm not a fan of the "proxy_cache_valid 5m" form for the very same
reasons, and would rather avoid changing it.
More information about the nginx-devel