]> git.kaiwu.me - nginx.git/commitdiff
Added warning about unset cache keys.
authorMaxim Dounin <mdounin@mdounin.ru>
Thu, 11 Sep 2014 16:08:52 +0000 (20:08 +0400)
committerMaxim Dounin <mdounin@mdounin.ru>
Thu, 11 Sep 2014 16:08:52 +0000 (20:08 +0400)
In fastcgi, scgi and uwsgi modules there are no default cache keys, and
using a cache without a cache key set is likely meaningless.

src/http/modules/ngx_http_fastcgi_module.c
src/http/modules/ngx_http_scgi_module.c
src/http/modules/ngx_http_uwsgi_module.c

index 8016f5b75baad1d3436add1b824ceb2a11fcb2f2..7be137a16ddd3a7269f7c1d49212d52bfc426107 100644 (file)
@@ -2582,6 +2582,11 @@ ngx_http_fastcgi_merge_loc_conf(ngx_conf_t *cf, void *parent, void *child)
         conf->cache_key = prev->cache_key;
     }
 
+    if (conf->upstream.cache && conf->cache_key.value.data == NULL) {
+        ngx_conf_log_error(NGX_LOG_WARN, cf, 0,
+                           "no \"fastcgi_cache_key\" for \"fastcgi_cache\"");
+    }
+
     ngx_conf_merge_value(conf->upstream.cache_lock,
                               prev->upstream.cache_lock, 0);
 
index 1626984dd5520b1208543148f5cfdebc0cc03118..b4b89ffaaaf4faa3d54f6c4b304c5d8c770ba897 100644 (file)
@@ -1337,6 +1337,11 @@ ngx_http_scgi_merge_loc_conf(ngx_conf_t *cf, void *parent, void *child)
         conf->cache_key = prev->cache_key;
     }
 
+    if (conf->upstream.cache && conf->cache_key.value.data == NULL) {
+        ngx_conf_log_error(NGX_LOG_WARN, cf, 0,
+                           "no \"scgi_cache_key\" for \"scgi_cache\"");
+    }
+
     ngx_conf_merge_value(conf->upstream.cache_lock,
                               prev->upstream.cache_lock, 0);
 
index 3956036a994b5bef5a05ec0e7ebe4da8bd7ddb29..0185cbac76c94173db9e8a58ff794d69a574c895 100644 (file)
@@ -1524,6 +1524,11 @@ ngx_http_uwsgi_merge_loc_conf(ngx_conf_t *cf, void *parent, void *child)
         conf->cache_key = prev->cache_key;
     }
 
+    if (conf->upstream.cache && conf->cache_key.value.data == NULL) {
+        ngx_conf_log_error(NGX_LOG_WARN, cf, 0,
+                           "no \"uwsgi_cache_key\" for \"uwsgi_cache\"");
+    }
+
     ngx_conf_merge_value(conf->upstream.cache_lock,
                               prev->upstream.cache_lock, 0);