Welcome! Log In Create A New Profile

Advanced

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

Piotr Sikora
November 24, 2014 05:42PM
Hey Maxim,

> That's up to a configuration.

You're right... It seems like a waste of disk space to me, but nginx
can be forced to do that.

This still leaves us with only 200 and 206.

> Which problem? You are trying to convince me that that
> conditional requests shouldn't be used to revalidate responses
> with non-200 status code because it may not work with some
> upstream servers. Sure, this can happen. Moreover, it can happen
> with responses with 200 status code, too.

No, I'm saying that it cannot work.

Maybe I shouldn't have tried to explain the reasoning behind
fd283aa92e04, because it looks that it just added confusion, so let's
start again.

1. client #1 requests "/logo.png" from website behind nginx,
2. nginx doesn't have "/logo.png" in cache, so it sends request upstream,
3. upstream server rate-limits nginx and replies with 503:

HTTP/1.1 503 Service Temporarily Unavailable
Last-Modified: Mon, 24 Nov 2014 22:00:00 GMT

4. 503 gets force-cached at nginx (due to configuration),
5. client #2 requests "/logo.png" from website behind nginx,
6. nginx has "/logo.png" in cache, but it's expired, so it tries to
revalidate it:

GET /logo.png HTTP/1.1
If-Modified-Since: Mon, 24 Nov 2014 22:00:00 GMT

7. upstream replies with 304, accidentally revalidating 503:

HTTP/1.1 304 Not Modified

even though, the 304 is generated from:

HTTP/1.1 200 OK
Last-Modified: Mon, 10 Nov 2014 00:00:00 GMT

not from the rate-limiting.

This scenario describes perfectly behaving upstream server, the only
issue here is that nginx tries to revalidate response that cannot be
revalidated and applies 304 Not Modified response to it.

> Two trivial solutions include:
>
> - fix an upstream server;

There is no issue with the upstream server, only with nginx
revalidating non-200 status codes.

> - disable use of conditional requests, it's off by default.

So you're saying that just because it's off by default, it's fine for
it to be broken?

Best regards,
Piotr Sikora

_______________________________________________
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 491 November 20, 2014 11:40AM

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

Piotr Sikora 402 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 498 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 418 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 513 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: 184
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