Opened 9 months ago

Closed 9 months ago

Last modified 9 months ago

#1840 closed defect (invalid)

Request different accept-encoding types, caching out multiple files. What is the reason?

Reported by: yunoasgit@… Owned by:
Priority: minor Milestone:
Component: other Version: 1.16.x
Keywords: Cc:
uname -a:
nginx -V: nginx version: nginx/1.16.0

Description

Request different accept-encoding types, caching out multiple files. What is the reason?
If only one type, one cached file
The request is settled. Thank you.

nginx version: nginx/1.16.0
conf:


proxy_cache_path /cache/www_cache levels=1:2 keys_zone=www_cache:500m inactive=7d max_size=1000m;

location ~ .*\.(xml|htm|html|css|js)(.*) {

proxy_pass http://www.xxxxxx.com;
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header Connection "";
proxy_set_header Accept-Encoding ;
proxy_http_version 1.1;
client_body_buffer_size 128k;
proxy_connect_timeout 60;
proxy_send_timeout 60;
proxy_read_timeout 60;
proxy_buffer_size 32k;
proxy_buffers 4 32k;
proxy_busy_buffers_size 64k;
proxy_temp_file_write_size 64k;
proxy_cache www_cache;
proxy_cache_valid 200 302 30m;
proxy_cache_valid 301 30m;
proxy_cache_valid any 1m;
proxy_cache_key $host$uri$is_args$args;

}


test run
#1
curl -o /dev/null "http://www.xxxxxx.com/common/js/jquery.min.js" -H "User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.100 Safari/537.36" -x 10.1.186.72:80
#2
curl -o /dev/null 'http://www.xxxxxx.com/common/js/jquery.min.js' -H 'User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.100 Safari/537.36' -H 'accept-encoding: gzip, deflate, br' -x 10.1.186.72:80
#3
curl -o /dev/null 'http://www.xxxxxx.com/common/js/jquery.min.js' -H 'User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.100 Safari/537.36' -H 'accept-encoding: gzip, deflate' -x 10.1.186.72:80
#4
curl -o /dev/null 'http://www.xxxxxx.com/common/js/jquery.min.js' -H 'User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.100 Safari/537.36' -H 'accept-encoding: gzip' -x 10.1.186.72:80
#5
curl -o /dev/null 'http://www.xxxxxx.com/common/js/jquery.min.js' -H 'User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.100 Safari/537.36' -H 'accept-encoding: deflate, gzip' -x 10.1.186.72:80
#6
curl -o /dev/null 'http://www.xxxxxx.com/common/js/jquery.min.js' -H 'User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.100 Safari/537.36' -H 'accept-encoding: deflate, gzip, br ' -x 10.1.186.72:80


Six different file list,
The content is the same, accept-encoding is different

./6/06/6ba389ade4e2d55d4e66fbb8d99e5066
./0/70/8df2f99ae842a8d7f5d5192da6e39700
./e/dd/2db0e8eef68e05aaa0b9fbb01a7dbdde
./d/09/b829dd1da559e3c80aeaabf58374c09d
./a/c3/547655366b88299921b477dbeeffdc3a
./a/72/61a3eac721aa5d15a14b64630d89172a

Six different file list


# head -15 ./a/72/61a3eac721aa5d15a14b64630d89172a
H?]?m\8?d]?y|?"5c6d04a1-169d9"Accept-Encoding??

08

KEY: www.xxxxxx.com/common/js/jquery.min.js
HTTP/1.1 200 OK
Server: openresty
Date: Tue, 27 Aug 2019 05:14:32 GMT
Content-Type: application/javascript; charset=utf-8
Content-Length: 92633
Last-Modified: Wed, 20 Feb 2019 07:41:21 GMT
Connection: keep-alive
Vary: Accept-Encoding
ETag: "5c6d04a1-169d9"
Expires: Tue, 27 Aug 2019 06:14:32 GMT
Cache-Control: max-age=3600
Accept-Ranges: bytes

# head -15 ./a/c3/547655366b88299921b477dbeeffdc3a
m?]?m\]?d]?y|?"5c6d04a1-169d9"Accept-EncodingTvU6k)!′w???
KEY: www.xxxxxx.com/common/js/jquery.min.js
HTTP/1.1 200 OK
Server: openresty
Date: Tue, 27 Aug 2019 05:19:26 GMT
Content-Type: application/javascript; charset=utf-8
Content-Length: 92633
Last-Modified: Wed, 20 Feb 2019 07:41:21 GMT
Connection: keep-alive
Vary: Accept-Encoding
ETag: "5c6d04a1-169d9"
Expires: Tue, 27 Aug 2019 06:19:26 GMT
Cache-Control: max-age=3600
Accept-Ranges: bytes

# head -16 ./d/09/b829dd1da559e3c80aeaabf58374c09d
H?]?m\8?d]?y|?"5c6d04a1-169d9"Accept-Encoding?)?¥Y
?t
KEY: www.xxxxxx.com/common/js/jquery.min.js
HTTP/1.1 200 OK
Server: openresty
Date: Tue, 27 Aug 2019 05:14:32 GMT
Content-Type: application/javascript; charset=utf-8
Content-Length: 92633
Last-Modified: Wed, 20 Feb 2019 07:41:21 GMT
Connection: keep-alive
Vary: Accept-Encoding
ETag: "5c6d04a1-169d9"
Expires: Tue, 27 Aug 2019 06:14:32 GMT
Cache-Control: max-age=3600
Accept-Ranges: bytes

# head -15 ./e/dd/2db0e8eef68e05aaa0b9fbb01a7dbdde
H?]?m\8?d]?y|?"5c6d04a1-169d9"Accept-Encoding-°鯶a?1齽
KEY: www.xxxxxx.com/common/js/jquery.min.js
HTTP/1.1 200 OK
Server: openresty
Date: Tue, 27 Aug 2019 05:14:32 GMT
Content-Type: application/javascript; charset=utf-8
Content-Length: 92633
Last-Modified: Wed, 20 Feb 2019 07:41:21 GMT
Connection: keep-alive
Vary: Accept-Encoding
ETag: "5c6d04a1-169d9"
Expires: Tue, 27 Aug 2019 06:14:32 GMT
Cache-Control: max-age=3600
Accept-Ranges: bytes

#head -15 ./0/70/8df2f99ae842a8d7f5d5192da6e39700
H?]?m\8?d]?y|?"5c6d04a1-169d9"Accept-Encoding雨B¨??-|
KEY: www.xxxxxx.com/common/js/jquery.min.js
HTTP/1.1 200 OK
Server: openresty
Date: Tue, 27 Aug 2019 05:14:32 GMT
Content-Type: application/javascript; charset=utf-8
Content-Length: 92633
Last-Modified: Wed, 20 Feb 2019 07:41:21 GMT
Connection: keep-alive
Vary: Accept-Encoding
ETag: "5c6d04a1-169d9"
Expires: Tue, 27 Aug 2019 06:14:32 GMT
Cache-Control: max-age=3600
Accept-Ranges: bytes

#head -15 ./6/06/6ba389ade4e2d55d4e66fbb8d99e5066
??]?m\/?d]?y|?"5c6d04a1-169d9"Accept-Encodingk£-壕]Nf靐f
KEY: www.xxxxxx.com/common/js/jquery.min.js
HTTP/1.1 200 OK
Server: openresty
Date: Tue, 27 Aug 2019 05:18:39 GMT
Content-Type: application/javascript; charset=utf-8
Content-Length: 92633
Last-Modified: Wed, 20 Feb 2019 07:41:21 GMT
Connection: keep-alive
Vary: Accept-Encoding
ETag: "5c6d04a1-169d9"
Expires: Tue, 27 Aug 2019 06:18:39 GMT
Cache-Control: max-age=3600
Accept-Ranges: bytes


end

Change History (6)

comment:1 by yunoasgit@…, 9 months ago

test

Version 0, edited 9 months ago by yunoasgit@… (next)

comment:2 by Maxim Dounin, 9 months ago

Resolution: invalid
Status: newclosed

The reason is that response is available in multiple variants, as indicated by the Vary response header field. If you have further questions, consider using support options available.

comment:3 by yunoasgit@…, 9 months ago

This is not the case with older versions, such as nginx-1.2.9

This is the case with the new version

How do I close it? I don't want multiple caches as long as one

Last edited 9 months ago by yunoasgit@… (previous) (diff)

in reply to:  2 comment:4 by yunoasgit@…, 9 months ago

This is not the case with older versions, such as nginx-1.2.9

This is the case with the new version

Replying to mdounin:

The reason is that response is available in multiple variants, as indicated by the Vary response header field. If you have further questions, consider using support options available.

comment:5 by Maxim Dounin, 9 months ago

As previously suggested, if you have further questions, consider using support options available. Or check docs, which might be faster.

in reply to:  5 comment:6 by yunoasgit@…, 9 months ago

Thank you for your reply.
No settings,No way
proxy_ignore_headers Accept-Encoding ;

Thank you, optional settings, proxy_ignore_headers Vary;

Replying to mdounin:

As previously suggested, if you have further questions, consider using support options available. Or check docs, which might be faster.

Last edited 9 months ago by yunoasgit@… (previous) (diff)
Note: See TracTickets for help on using tickets.