aboutsummaryrefslogtreecommitdiff
path: root/src/http/modules/ngx_http_proxy_module.c
diff options
context:
space:
mode:
authorRoman Arutyunyan <arut@nginx.com>2015-11-11 15:47:30 +0300
committerRoman Arutyunyan <arut@nginx.com>2015-11-11 15:47:30 +0300
commit89a049be89a2d0507bf1e4558733934bf6597432 (patch)
treee21a83691a7fe266008f413d14966cec9b89604c /src/http/modules/ngx_http_proxy_module.c
parent93aef089b44cf2a0bcb276eaa17ccea43024f5c2 (diff)
downloadnginx-89a049be89a2d0507bf1e4558733934bf6597432.tar.gz
nginx-89a049be89a2d0507bf1e4558733934bf6597432.zip
Upstream: proxy_cache_convert_head directive.
The directive toggles conversion of HEAD to GET for cacheable proxy requests. When disabled, $request_method must be added to cache key for consistency. By default, HEAD is converted to GET as before.
Diffstat (limited to 'src/http/modules/ngx_http_proxy_module.c')
-rw-r--r--src/http/modules/ngx_http_proxy_module.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/http/modules/ngx_http_proxy_module.c b/src/http/modules/ngx_http_proxy_module.c
index 514c23bac..193350914 100644
--- a/src/http/modules/ngx_http_proxy_module.c
+++ b/src/http/modules/ngx_http_proxy_module.c
@@ -533,6 +533,13 @@ static ngx_command_t ngx_http_proxy_commands[] = {
offsetof(ngx_http_proxy_loc_conf_t, upstream.cache_revalidate),
NULL },
+ { ngx_string("proxy_cache_convert_head"),
+ NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_FLAG,
+ ngx_conf_set_flag_slot,
+ NGX_HTTP_LOC_CONF_OFFSET,
+ offsetof(ngx_http_proxy_loc_conf_t, upstream.cache_convert_head),
+ NULL },
+
#endif
{ ngx_string("proxy_temp_path"),
@@ -2845,6 +2852,7 @@ ngx_http_proxy_create_loc_conf(ngx_conf_t *cf)
conf->upstream.cache_lock_timeout = NGX_CONF_UNSET_MSEC;
conf->upstream.cache_lock_age = NGX_CONF_UNSET_MSEC;
conf->upstream.cache_revalidate = NGX_CONF_UNSET;
+ conf->upstream.cache_convert_head = NGX_CONF_UNSET;
#endif
conf->upstream.hide_headers = NGX_CONF_UNSET_PTR;
@@ -3143,6 +3151,9 @@ ngx_http_proxy_merge_loc_conf(ngx_conf_t *cf, void *parent, void *child)
ngx_conf_merge_value(conf->upstream.cache_revalidate,
prev->upstream.cache_revalidate, 0);
+ ngx_conf_merge_value(conf->upstream.cache_convert_head,
+ prev->upstream.cache_convert_head, 1);
+
#endif
ngx_conf_merge_str_value(conf->method, prev->method, "");