# HG changeset patch
# User Gena Makhomed <g...@csdoc.com>
# Date 1516650013 -7200
#      Mon Jan 22 21:40:13 2018 +0200
# Node ID 4f635c5c8da929eb1e25bc8fbce7d7d5726468cf
# Parent  cbf59d483c9cd94dc0fb05f1978601d02af69c20
Upstream: fastcgi_cache_convert_head directive.

The directive toggles conversion of HEAD to GET for cacheable fastcgi requests.
When disabled, $request_method must be added to cache key for consistency.
By default, HEAD is converted to GET as before.

After previous patch http://hg.nginx.org/nginx/rev/4d5ac1a31d44
HEAD is not converted to GET as before for cacheable fastcgi requests.

This patch fixes fastcgi cache regression introduced
by patch http://hg.nginx.org/nginx/rev/4d5ac1a31d44

diff -r cbf59d483c9c -r 4f635c5c8da9 src/http/modules/ngx_http_fastcgi_module.c --- a/src/http/modules/ngx_http_fastcgi_module.c Tue Jan 16 13:52:03 2018 +0300 +++ b/src/http/modules/ngx_http_fastcgi_module.c Mon Jan 22 21:40:13 2018 +0200
@@ -470,6 +470,13 @@
       offsetof(ngx_http_fastcgi_loc_conf_t, upstream.cache_revalidate),
       NULL },

+    { ngx_string("fastcgi_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_fastcgi_loc_conf_t, upstream.cache_convert_head),
+      NULL },
+
     { ngx_string("fastcgi_cache_background_update"),

NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_FLAG,
       ngx_conf_set_flag_slot,
@@ -2781,6 +2788,7 @@
     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;
     conf->upstream.cache_background_update = NGX_CONF_UNSET;
 #endif

@@ -3074,6 +3082,9 @@
     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);
+
     ngx_conf_merge_value(conf->upstream.cache_background_update,
                               prev->upstream.cache_background_update, 0);

_______________________________________________
nginx-devel mailing list
nginx-devel@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-devel

Reply via email to