Welcome! Log In Create A New Profile

Advanced

Re: [PATCH 2 of 2] Cache: send conditional requests only for cached 200 OK responses

Maxim Dounin
November 20, 2014 11:40AM
Hello!

On Wed, Nov 19, 2014 at 01:52:34PM -0800, Piotr Sikora wrote:

> Hey Maxim,
>
> > And what's wrong with it?
> > I don't see why this should be status-specific.
>
> Because, according to the RFC, 304 Not Modified can be only emitted
> for 200 OK responses, so we know that revalidation of other status
> codes cannot happen, at least not when talking with well-behaving
> server, so sending conditional requests for such cached responses is
> pointless.

For example, it can be usable with 206 responses as well (and this
is perfectly allowed by the RFC).

> Maybe I should elaborate a bit more on the problem I'm trying to
> workaround, which is also the underlying reason for the fix I made in
> fd283aa92e04.
>
> Prior to that commit, when nginx cached 404 Not Found response without
> Last-Modified header, i.e. with such minimal headers:
>
> HTTP/1.1 404 Not Found
> Date: Wed, 19 Nov 2014 21:12:47 GMT
>
> it would always try to revalidate it with bogus If-Modified-Since header:
>
> GET /notfound HTTP/1.1
> Host: www.example.com
> If-Modified-Since: Thu, 01 Jan 1970 00:00:00 GMT
>
> for which upstream server would usually respond with full 404 Not
> Found response (not 304 Not Modified), unless the file appeared on the
> upstream server (and would have resulted in 200 OK for unconditional
> requests), then it would respond with 304 Not Modified (thanks to the
> broken If-Modified-Since test on their side), revalidating 404 Not
> Found based on the 200 OK response.
>
> The problem mostly disappeared after fd283aa92e04, but it can still
> happen, e.g. when cached 404 Not Found response with Last-Modified
> header will be revalidated (and hence cached forever) by 304 Not
> Modified sent instead of 200 OK response with Last-Modified header
> older than the one in cached response.
>
> Hopefully that explains the problem enough... Let me know if you still
> have any doubt as to why it is important to change the current
> behavior to send conditional requests only for cached 200 OK
> responses.

I still think this approach is wrong, the behaviour shouldn't
depend on the status code.

--
Maxim Dounin
http://nginx.org/

_______________________________________________
nginx-devel mailing list
nginx-devel@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-devel
Subject Author Views Posted

[PATCH 1 of 2] Cache: remove unused valid_msec fields

Piotr Sikora 913 November 18, 2014 08:18PM

[PATCH 2 of 2] Cache: send conditional requests only for cached 200 OK responses

Piotr Sikora 422 November 18, 2014 08:18PM

Re: [PATCH 2 of 2] Cache: send conditional requests only for cached 200 OK responses

Maxim Dounin 445 November 19, 2014 11:40AM

Re: [PATCH 2 of 2] Cache: send conditional requests only for cached 200 OK responses

Piotr Sikora 513 November 19, 2014 04:54PM

Re: [PATCH 2 of 2] Cache: send conditional requests only for cached 200 OK responses

Maxim Dounin 490 November 20, 2014 11:40AM

Re: [PATCH 2 of 2] Cache: send conditional requests only for cached 200 OK responses

Piotr Sikora 401 November 23, 2014 06:46AM

Re: [PATCH 2 of 2] Cache: send conditional requests only for cached 200 OK responses

steveh 581 November 23, 2014 07:34AM

Re: [PATCH 2 of 2] Cache: send conditional requests only for cached 200 OK responses

Maxim Dounin 429 November 24, 2014 10:06AM

Re: [PATCH 2 of 2] Cache: send conditional requests only for cached 200 OK responses

Piotr Sikora 442 November 24, 2014 05:42PM

Re: [PATCH 2 of 2] Cache: send conditional requests only for cached 200 OK responses

Maxim Dounin 1008 November 25, 2014 08:44AM

Re: [PATCH 2 of 2] Cache: send conditional requests only for cached 200 OK responses

Piotr Sikora 497 November 25, 2014 08:16PM

Re: [PATCH 2 of 2] Cache: send conditional requests only for cached 200 OK responses

Maxim Dounin 457 November 26, 2014 09:56AM

[PATCH] Cache: send conditional requests only for cached 200/206 responses

Piotr Sikora 427 November 25, 2014 08:42PM

Re: [PATCH] Cache: send conditional requests only for cached 200/206 responses

Maxim Dounin 417 November 26, 2014 09:56AM

[PATCH] Cache: send conditional requests only for cached 200/206 responses

Piotr Sikora 449 November 26, 2014 09:40PM

Re: [PATCH] Cache: send conditional requests only for cached 200/206 responses

Maxim Dounin 512 December 04, 2014 01:16PM

Re: [PATCH 1 of 2] Cache: remove unused valid_msec fields

Maxim Dounin 444 November 19, 2014 11:46AM

Re: [PATCH 1 of 2] Cache: remove unused valid_msec fields

Piotr Sikora 471 November 19, 2014 04:08PM

Re: [PATCH 1 of 2] Cache: remove unused valid_msec fields

Maxim Dounin 439 November 20, 2014 11:16AM

Re: [PATCH 1 of 2] Cache: remove unused valid_msec fields

Piotr Sikora 452 November 25, 2014 08:16PM



Sorry, you do not have permission to post/reply in this forum.

Online Users

Guests: 206
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready