Opened 9 years ago

Closed 9 years ago

#922 closed defect (invalid)

proxy_cache use wrong file name, if set on backend "gzip on".

Reported by: lefoyer@… Owned by:
Priority: minor Milestone:
Component: nginx-module Version: 1.9.x
Keywords: proxy_cache Cc: admin@…
uname -a: Linux hw-sld-prod-front-001 3.16.0-4-amd64 #1 SMP Debian 3.16.7-ckt20-1+deb8u3 (2016-01-17) x86_64 GNU/Linux
nginx -V: nginx version: nginx/1.9.10
built with OpenSSL 1.0.1k 8 Jan 2015
TLS SNI support enabled
configure arguments: --with-cc-opt='-g -O2 -fPIE -fstack-protector-strong -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2' --with-ld-opt='-fPIE -pie -Wl,-z,relro -Wl,-z,now' --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 --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-ipv6 --with-http_ssl_module --with-http_stub_status_module --with-http_realip_module --with-http_auth_request_module --with-http_addition_module --with-http_dav_module --with-http_flv_module --with-http_geoip_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_image_filter_module --with-http_mp4_module --with-http_perl_module --with-http_random_index_module --with-http_secure_link_module --with-http_v2_module --with-http_sub_module --with-http_xslt_module --with-mail --with-mail_ssl_module --with-stream --with-stream_ssl_module --with-threads --add-module=/build/nginx-1.9.10/debian/modules/headers-more-nginx-module --add-module=/build/nginx-1.9.10/debian/modules/nginx-auth-pam --add-module=/build/nginx-1.9.10/debian/modules/nginx-cache-purge --add-module=/build/nginx-1.9.10/debian/modules/nginx-dav-ext-module --add-module=/build/nginx-1.9.10/debian/modules/nginx-development-kit --add-module=/build/nginx-1.9.10/debian/modules/nginx-echo --add-module=/build/nginx-1.9.10/debian/modules/ngx-fancyindex --add-module=/build/nginx-1.9.10/debian/modules/nginx-http-push --add-module=/build/nginx-1.9.10/debian/modules/nginx-lua --add-module=/build/nginx-1.9.10/debian/modules/nginx-upload-progress --add-module=/build/nginx-1.9.10/debian/modules/nginx-upstream-fair --add-module=/build/nginx-1.9.10/debian/modules/ngx_http_substitutions_filter_module

Description

proxy_cache use wrong file name (first request from firefox=md5(proxy_key), second request from chrome != md5(proxy_key)), if set on backend "gzip on".

I am reproduse this bug on nginx 1.8.1

For reproduce:
/etc/nginx# cat nginx.conf
user www-data;

pid /run/nginx.pid;

events {

worker_connections 786;

}

http {

proxy_cache_path /var/cache/fscache/ngcache levels=1:2 keys_zone=fastcache:40m inactive=7d max_size=600g use_temp_path=off;
proxy_cache_min_uses 1;
proxy_cache_methods GET HEAD;
proxy_http_version 1.1;

include /etc/nginx/mime.types;
default_type application/octet-stream;

ssl off;

access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;

gzip on;
gzip_disable "msie6";

gzip_vary on;
gzip_proxied any;
gzip_comp_level 6;
gzip_buffers 16 8k;
gzip_http_version 1.1;
gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript image/svg+xml;

server {

listen 127.0.0.1:80;
server_name test.local *.test.local;

root /var/www/html;
index index.html index.htm;

location / {

try_files $uri $uri/ =404;

}

}

server {

listen 80;
server_name test.local *.test.local;

root /var/www/html;
index index.html index.htm;

location / {

proxy_pass http://127.0.0.1:80/;
proxy_cache fastcache;
proxy_cache_key $request_method|$host|$uri;
proxy_cache_valid 200 15m;
proxy_set_header Host $http_host;

}

}

}

/var/www/html/test# cat test.css
table.programm-table {

margin: 0 0 35px !important;

}

table.programm-table {

}

table.programm-table tbody tr {

background: #F9F9F9;

}

table.programm-table tbody tr td input,
table.programm-table tbody tr td select {

width: 100%;

}

#plupload-upload-ui .in-progress {

display: none;

}

#plupload-upload-ui.in-progress .can-upload {

display: none;

}

#plupload-upload-ui.in-progress .in-progress {

display: block;

}

#xml-programm-posts,
#xml-programms-list {

margin: 40px 0 0;

}

.xml-posts h2 {

padding: 10px !important;
background: #F9F9F9;
border: 1px solid #e5e5e5;
-webkit-box-shadow: 0 -1px 1px rgba(0,0,0,.04);
box-shadow: 0 -1px 1px rgba(0,0,0,.04);
border-bottom: none;

}

write in host test.local you wan server ip.

Request http://test.local/test/test.css from Firefox and Chrome.

My result in attach (2 file).

Attachments (1)

ngcache.tar.gz (975 bytes ) - added by lefoyer@… 9 years ago.
result

Download all attachments as: .zip

Change History (3)

by lefoyer@…, 9 years ago

Attachment: ngcache.tar.gz added

result

comment:1 by lefoyer@…, 9 years ago

This not bug. This not full information in documentation.
I am rewrite my test config (for support only gzip compression). And all good. Please update documentation.

server {

listen 80;
server_name test.local *.test.local;

root /var/www/html;
index index.html index.htm;

set $ae "";
if ($http_accept_encoding ~* gzip) {

set $ae "gzip";

}

location / {

proxy_pass http://127.0.0.1:80/;
proxy_cache fastcache;
proxy_cache_key $request_method|$host|$uri|$ae;
proxy_cache_valid 200 15m;
proxy_set_header Host $http_host;
proxy_ignore_headers "Vary";
proxy_set_header Accept-Encoding $ae;
add_header X-Proxy-Cache $upstream_cache_status;

}

}

comment:2 by Maxim Dounin, 9 years ago

Resolution: invalid
Status: newclosed

Documentation says:

If the header includes the “Vary” field with the special value “*”, such a response will not be cached (1.7.7). If the header includes the “Vary” field with another value, such a response will be cached taking into account the corresponding request header fields (1.7.7).

When there are multiple variants of a resource, names of additional variants are implementation-defined.

Note: See TracTickets for help on using tickets.