#2029 closed defect (fixed)
Cache miss due to "cache file .. has too long header" when using "Vary"
Reported by: | João Salavessa | Owned by: | |
---|---|---|---|
Priority: | major | Milestone: | |
Component: | nginx-module | Version: | 1.19.x |
Keywords: | proxy cache vary | Cc: | João Salavessa |
uname -a: | Linux nginx-54959fc7bf-ncmrh 4.19.114 #1 SMP Mon Aug 3 12:35:22 PDT 2020 x86_64 Linux | ||
nginx -V: |
nginx version: nginx/1.19.2
built by gcc 9.3.0 (Alpine 9.3.0) built with OpenSSL 1.1.1g 21 Apr 2020 TLS SNI support enabled configure arguments: --prefix=/etc/nginx --sbin-path=/usr/sbin/nginx --modules-path=/usr/lib/nginx/modules --conf-path=/etc/nginx/nginx.conf --error-log-path=/var/log/nginx/error.log --http-log-path=/var/log/nginx/a ccess.log --pid-path=/var/run/nginx.pid --lock-path=/var/run/nginx.lock --http-client-body-temp-path=/var/cache/nginx/client_temp --http-proxy-temp-path=/var/cache/nginx/proxy_temp --http-fastcgi-temp-path=/var/cach e/nginx/fastcgi_temp --http-uwsgi-temp-path=/var/cache/nginx/uwsgi_temp --http-scgi-temp-path=/var/cache/nginx/scgi_temp --with-perl_modules_path=/usr/lib/perl5/vendor_perl --user=nginx --group=nginx --with-compat - -with-file-aio --with-threads --with-http_addition_module --with-http_auth_request_module --with-http_dav_module --with-http_flv_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_mp4_module --with-http_random_index_module --with-http_realip_module --with-http_secure_link_module --with-http_slice_module --with-http_ssl_module --with-http_stub_status_module --with-http_sub_module --with-http_v2_module - -with-mail --with-mail_ssl_module --with-stream --with-stream_realip_module --with-stream_ssl_module --with-stream_ssl_preread_module --with-cc-opt='-Os -fomit-frame-pointer' --with-ld-opt=-Wl,--as-needed |
Description
There are some cases when "Vary" header is present and it changes value in a consequent call then a perfectly valid newly updated cache file (e.g. from a MISS) can trigger another MISS on the next exact same call due to "cache file .. has too long header" check.
Attached "nginx.conf" and "test-cases.sh" which contains description of issue and functions with call sequences that consistently reproduce the issue (tested on the current latest nginx versions 1.18.0 and 1.19.2):
- the "returnVary" req header asks the server to return the request header value as Vary response header value
- the "xtra" req header header asks the server to include a "Xtra" response header with the respective value
To execute attached test cases just start a local nginx using the attached "nginx.conf" file and:
# test cases execution: "loop" executes function in first argument, 4 times with 3s sleep between each (nginx.conf cache TTL is 5s) # source test case functions . ./test-cases.sh # execution command examples loop tc1 #not ok loop tc2 #not ok loop tc3 #ok loop tc4 #ok loop tc5 #ok tc3_5; sleep 6; tc4_5 #not ok
Attachments (2)
Change History (8)
by , 4 years ago
Attachment: | nginx.conf added |
---|
by , 4 years ago
Attachment: | test-cases.sh added |
---|
follow-up: 6 comment:1 by , 4 years ago
comment:2 by , 4 years ago
Keywords: | proxy cache added; ngx_http_proxy_module removed |
---|---|
Status: | new → accepted |
comment:3 by , 4 years ago
I had already made exhaustive checks with the first patch applied and didn't really make any difference for the reported issue - but it didn't make it any worse either.
I'll test nginx with both patches applied and get back with the result.
Thanks!
comment:5 by , 4 years ago
Resolution: | → fixed |
---|---|
Status: | accepted → closed |
For the record, both changes were committed and should appear in 1.19.3.
But still, feedback is always welcome.
comment:6 by , 4 years ago
Replying to Sergey Kandaurov:
Please try these changes.
The first change is for a different issue previously reported.
It would be nice if you could test with both applied and report back.
[...]
I can confirm that everything is working as expected after applying the two patches.
Thanks for the commit and sorry for the delay in the reply.
Please try these changes.
The first change is for a different issue previously reported.
It would be nice if you could test with both applied and report back.