From 362030ba6b4b28c1e92bb3bc5a8ede7f788cc1ab Mon Sep 17 00:00:00 2001 From: Luke Childs Date: Tue, 19 Apr 2016 15:05:41 +0100 Subject: [PATCH] Use $http_host instead of $host for cache keys $http_host is case sensitive so reduces the chance of cache key collisions --- ee/cli/templates/fastcgi.mustache | 2 +- ee/cli/templates/redis-hhvm.mustache | 2 +- ee/cli/templates/redis-php7.mustache | 2 +- ee/cli/templates/redis.mustache | 2 +- ee/cli/templates/wpfc-hhvm.mustache | 2 +- ee/cli/templates/wpfc-php7.mustache | 2 +- ee/cli/templates/wpfc.mustache | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/ee/cli/templates/fastcgi.mustache b/ee/cli/templates/fastcgi.mustache index 6d4bc4ba..53bdc55e 100644 --- a/ee/cli/templates/fastcgi.mustache +++ b/ee/cli/templates/fastcgi.mustache @@ -1,6 +1,6 @@ # FastCGI cache settings fastcgi_cache_path /var/run/nginx-cache levels=1:2 keys_zone=WORDPRESS:50m inactive=60m; -fastcgi_cache_key "$scheme$request_method$host$request_uri"; +fastcgi_cache_key "$scheme$request_method$http_host$request_uri"; fastcgi_cache_use_stale error timeout invalid_header updating http_500 http_503; fastcgi_cache_valid 200 301 302 404 1h; fastcgi_buffers 16 16k; diff --git a/ee/cli/templates/redis-hhvm.mustache b/ee/cli/templates/redis-hhvm.mustache index 9efa2236..9406acfd 100644 --- a/ee/cli/templates/redis-hhvm.mustache +++ b/ee/cli/templates/redis-hhvm.mustache @@ -36,7 +36,7 @@ location /redis-store { } location ~ \.php$ { - set $key "nginx-cache:$scheme$request_method$host$request_uri"; + set $key "nginx-cache:$scheme$request_method$http_host$request_uri"; try_files $uri =404; srcache_fetch_skip $skip_cache; diff --git a/ee/cli/templates/redis-php7.mustache b/ee/cli/templates/redis-php7.mustache index 1e4a8cd1..ef84c1a7 100644 --- a/ee/cli/templates/redis-php7.mustache +++ b/ee/cli/templates/redis-php7.mustache @@ -35,7 +35,7 @@ location /redis-store { } location ~ \.php$ { - set $key "nginx-cache:$scheme$request_method$host$request_uri"; + set $key "nginx-cache:$scheme$request_method$http_host$request_uri"; try_files $uri =404; srcache_fetch_skip $skip_cache; diff --git a/ee/cli/templates/redis.mustache b/ee/cli/templates/redis.mustache index 69cfa695..aadc71ea 100644 --- a/ee/cli/templates/redis.mustache +++ b/ee/cli/templates/redis.mustache @@ -36,7 +36,7 @@ location /redis-store { } location ~ \.php$ { - set $key "nginx-cache:$scheme$request_method$host$request_uri"; + set $key "nginx-cache:$scheme$request_method$http_host$request_uri"; try_files $uri =404; srcache_fetch_skip $skip_cache; diff --git a/ee/cli/templates/wpfc-hhvm.mustache b/ee/cli/templates/wpfc-hhvm.mustache index 6cce1e0d..20803bf0 100644 --- a/ee/cli/templates/wpfc-hhvm.mustache +++ b/ee/cli/templates/wpfc-hhvm.mustache @@ -32,6 +32,6 @@ location ~ \.php$ { fastcgi_cache WORDPRESS; } location ~ /purge(/.*) { - fastcgi_cache_purge WORDPRESS "$scheme$request_method$host$1"; + fastcgi_cache_purge WORDPRESS "$scheme$request_method$http_host$1"; access_log off; } diff --git a/ee/cli/templates/wpfc-php7.mustache b/ee/cli/templates/wpfc-php7.mustache index 0f3bc4a9..a077c1c3 100644 --- a/ee/cli/templates/wpfc-php7.mustache +++ b/ee/cli/templates/wpfc-php7.mustache @@ -32,6 +32,6 @@ location ~ \.php$ { fastcgi_cache WORDPRESS; } location ~ /purge(/.*) { - fastcgi_cache_purge WORDPRESS "$scheme$request_method$host$1"; + fastcgi_cache_purge WORDPRESS "$scheme$request_method$http_host$1"; access_log off; } diff --git a/ee/cli/templates/wpfc.mustache b/ee/cli/templates/wpfc.mustache index 81794ec7..1f3c47fc 100644 --- a/ee/cli/templates/wpfc.mustache +++ b/ee/cli/templates/wpfc.mustache @@ -32,6 +32,6 @@ location ~ \.php$ { fastcgi_cache WORDPRESS; } location ~ /purge(/.*) { - fastcgi_cache_purge WORDPRESS "$scheme$request_method$host$1"; + fastcgi_cache_purge WORDPRESS "$scheme$request_method$http_host$1"; access_log off; }