Welcome! Log In Create A New Profile

Advanced

Некорректный ответ при использовании fastcgi_cache_background_update on

gz
April 08, 2018 07:50PM
Добрый вечер.

При использовании fastcgi_cache_background_update наблюдаю странное поведение nginx.
Адрес недоступен, в кэше лежит ответ со статусом 404.

По истечении времени жизни кэша вместо обращения к апстриму и сохранения ответа со статусом 404 в кэш и отдачи его клиенту выдаётся ответ нулевой длины со статусом 200, который попадает в кэш.

0.0.0.0 - - [09/Apr/2018:01:31:32 +0300] "GET /missing/ HTTP/1.1" 404 3464 "-" "Mozilla/5.0"
0.0.0.0 - - [09/Apr/2018:01:33:32 +0300] "GET /missing/ HTTP/1.1" 404 3464 "-" "Mozilla/5.0"
0.0.0.0 - - [09/Apr/2018:01:35:33 +0300] "GET /missing/ HTTP/1.1" 404 3464 "-" "Mozilla/5.0"
0.0.0.0 - - [09/Apr/2018:01:37:32 +0300] "GET /missing/ HTTP/1.1" 404 3464 "-" "Mozilla/5.0"
0.0.0.0 - - [09/Apr/2018:01:37:52 +0300] "GET /missing/ HTTP/1.1" 200 0 "-" "Mozilla/5.0"
0.0.0.0 - - [09/Apr/2018:01:41:32 +0300] "GET /missing/ HTTP/1.1" 200 0 "-" "Mozilla/5.0"
0.0.0.0 - - [09/Apr/2018:01:43:32 +0300] "GET /missing/ HTTP/1.1" 200 0 "-" "Mozilla/5.0"
0.0.0.0 - - [09/Apr/2018:01:45:32 +0300] "GET /missing/ HTTP/1.1" 200 0 "-" "Mozilla/5.0"
0.0.0.0 - - [09/Apr/2018:01:47:33 +0300] "GET /missing/ HTTP/1.1" 200 0 "-" "Mozilla/5.0"

Стоит отключить fastcgi_cache_background_update — проблема исчезает.

Выдержка из конфигурации.
fastcgi_cache_lock on;
fastcgi_cache_lock_age 15s;
fastcgi_cache_use_stale error timeout updating http_500;
fastcgi_cache_background_update on;

fastcgi_cache_valid 404 410 5m;

----------
Ubuntu 16.04.4 LTS

nginx version: nginx/1.13.9
built with OpenSSL 1.0.2g 1 Mar 2016
TLS SNI support enabled
configure arguments: --with-cc-opt='-g -O2 -fPIE -fstack-protector-strong -Wformat -Werror=format-security -fPIC -Wdate-time -D_FORTIFY_SOURCE=2' --with-ld-opt='-Wl,-Bsymbolic-functions -fPIE -pie -Wl,-z,relro -Wl,-z,now -fPIC' --prefix=/usr/share/nginx --conf-path=/etc/nginx/nginx.conf --http-log-path=/var/log/nginx/access.log --error-log-path=/var/log/nginx/error.log --lock-path=/var/lock/nginx.lock --pid-path=/run/nginx.pid --modules-path=/usr/lib/nginx/modules --http-client-body-temp-path=/var/lib/nginx/body --http-fastcgi-temp-path=/var/lib/nginx/fastcgi --http-proxy-temp-path=/var/lib/nginx/proxy --http-scgi-temp-path=/var/lib/nginx/scgi --http-uwsgi-temp-path=/var/lib/nginx/uwsgi --with-debug --with-pcre-jit --with-http_ssl_module --with-http_stub_status_module --with-http_realip_module --with-http_auth_request_module --with-http_v2_module --with-http_dav_module --with-http_slice_module --with-threads --with-http_addition_module --with-http_geoip_module=dynamic --with-http_gunzip_module --with-http_gzip_static_module --with-http_image_filter_module=dynamic --with-http_sub_module --with-http_xslt_module=dynamic --with-stream=dynamic --with-stream_ssl_module --with-mail=dynamic --with-mail_ssl_module
Subject Author Posted

Некорректный ответ при использовании fastcgi_cache_background_update on

gz April 08, 2018 07:50PM

Re: Некорректный ответ при использовании fastcgi_cache_background_update on

gz April 08, 2018 08:54PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 97
Record Number of Users: 6 on February 13, 2018
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready