Opened 13 months ago

Last modified 11 months ago

#2569 closed defect

nginx serves stale 200 page which was deleted (became 404) — at Initial Version

Reported by: devpets@… Owned by:
Priority: major Milestone:
Component: nginx-core Version: 1.25.x
Keywords: cache stale 404 Cc:
uname -a: Linux 3.10.0-1160.42.2.el7.x86_64
nginx -V: nginx version: nginx/1.20.1

Description

Hello I've read same bugs here but they were closed so I open a new one since I believe its not logic condition.

nginx relevant config:
proxy_cache_methods GET HEAD;
proxy_cache_use_stale timeout invalid_header updating http_429 http_500 http_502 http_503 http_504 http_403; #

proxy_cache_valid 200 15s;
proxy_cache_valid 404 15s;

---
I create simple file 404.txt and doing curl two times:
curl https://x.x.x/404.txt -k -I
HTTP/2 200
server: nginx
date: Sun, 26 Nov 2023 07:44:29 GMT
content-type: text/plain; charset=UTF-8
content-length: 6
x-powered-by: WP Rocket/3.10.3
cache-control: public
x-xss-protection: 1; mode=block
x-content-type-options: nosniff
x-nginx-upstream-cache-status: MISS
accept-ranges: bytes

again:
HTTP/2 200
server: nginx
date: Sun, 26 Nov 2023 07:44:31 GMT
content-type: text/plain; charset=UTF-8
content-length: 6
x-powered-by: WP Rocket/3.10.3
cache-control: public
x-xss-protection: 1; mode=block
x-content-type-options: nosniff
x-nginx-upstream-cache-status: HIT
accept-ranges: bytes

As you see now the file is cached in nginx.
Now I go and remove this file from server and doing curl again 4 times:

curl https://x.x.x/404.txt -k -I

HTTP/2 200
server: nginx
date: Sun, 26 Nov 2023 07:45:27 GMT
content-type: text/plain; charset=UTF-8
content-length: 6
x-powered-by: WP Rocket/3.10.3
cache-control: public
x-xss-protection: 1; mode=block
x-content-type-options: nosniff
x-nginx-upstream-cache-status: STALE
accept-ranges: bytes

HTTP/2 200
server: nginx
date: Sun, 26 Nov 2023 07:45:29 GMT
content-type: text/plain; charset=UTF-8
content-length: 6
x-powered-by: WP Rocket/3.10.3
cache-control: public
x-xss-protection: 1; mode=block
x-content-type-options: nosniff
x-nginx-upstream-cache-status: STALE
accept-ranges: bytes

HTTP/2 200
server: nginx
date: Sun, 26 Nov 2023 07:46:34 GMT
content-type: text/plain; charset=UTF-8
content-length: 6
x-powered-by: WP Rocket/3.10.3
cache-control: public
x-xss-protection: 1; mode=block
x-content-type-options: nosniff
x-nginx-upstream-cache-status: UPDATING
accept-ranges: bytes

HTTP/2 200
server: nginx
date: Sun, 26 Nov 2023 07:46:48 GMT
content-type: text/plain; charset=UTF-8
content-length: 6
x-powered-by: WP Rocket/3.10.3
cache-control: public
x-xss-protection: 1; mode=block
x-content-type-options: nosniff
x-nginx-upstream-cache-status: STALE
accept-ranges: bytes

Now it stales forever, it never refresh.
I tried to add/remove this config:
proxy_cache_valid 404 15s;

but it doesn't change the behavior.

Please advise.
Dmitry Sherman

Change History (0)

Note: See TracTickets for help on using tickets.