Opened 11 years ago

Last modified 11 years ago

#454 reopened enhancement

disable ngx_http_upstream_store for HEAD requests

Reported by: Proforg M Owned by:
Priority: minor Milestone:
Component: nginx-module Version: 1.3.x
Keywords: Cc:
uname -a: Linux udaff 3.2.0-4-amd64 #1 SMP Debian 3.2.46-1 x86_64 GNU/Linux
nginx -V: nginx version: nginx/1.3.14
built by gcc 4.7.2 (Debian 4.7.2-5)
TLS SNI support enabled
configure arguments: --conf-path=/etc/nginx/nginx.conf --error-log-path=/var/log/nginx/error.log --pid-path=/var/run/nginx.pid --lock-path=/var/lock/nginx.lock --http-log-path=/var/log/nginx/access.log --http-client-body-temp-path=/var/lib/nginx/body --http-proxy-temp-path=/var/lib/nginx/proxy --http-fastcgi-temp-path=/var/lib/nginx/fastcgi --http-uwsgi-temp-path=/var/lib/nginx/uwsgi --http-scgi-temp-path=/var/lib/nginx/scgi --with-debug --with-file-aio --with-http_stub_status_module --with-http_addition_module --with-http_random_index_module --with-http_flv_module --with-http_ssl_module --with-http_dav_module --with-http_realip_module --with-http_secure_link_module --with-http_xslt_module --with-http_addition_module --with-http_image_filter_module --with-http_mp4_module --add-module=mod_zip --add-module=nginx-upload-progress-module --with-http_geoip_module --with-http_sub_module --add-module=nginx_substitutions_filter

Description

it looks like you missed check for

r->method == NGX_HTTP_GET

in

ngx_http_upstream_process_request(ngx_http_request_t *r)

so, if fastcgi_store directive is used, empty file will be stored on HEAD request

Change History (2)

comment:1 by Maxim Dounin, 11 years ago

Resolution: wontfix
Status: newclosed

The method can be redefined using proxy_method directive in case of proxy, or using appropriate fastcgi_param in case fastcgi. If the Content-Length header is present in a response, it's used to check if the response is complete. In case it may not be known on some responses, it's a good idea to explicitly define method used in backend requests. Alternatively, use proxy_cache/fastcgi_cache, which will do method mungling by itself, as well as many other things.

comment:2 by Proforg M, 11 years ago

Resolution: wontfix
Status: closedreopened

Thanks for the explanation!

Can you please explicitly describe this behavior in the official documentation ?
At the moment, the only information about this case is "no, it won't be cached, just proxied", which is differs from current state.

Note: See TracTickets for help on using tickets.