diff --git a/config/nginx/blot-blogs.conf b/config/nginx/blot-blogs.conf index 28cff91c1fa..5e5d734ed8c 100644 --- a/config/nginx/blot-blogs.conf +++ b/config/nginx/blot-blogs.conf @@ -4,8 +4,9 @@ root /cache; # use $request_uri if you want the query string also # use $uri if you don't -set $cache /$host$uri; -set $cache_index /$host$uri/index.html; +set $cache_permanent_folder /$host/$scheme/permanent$request_uri; +set $cache_blot_folder /$host/$scheme/temporary$request_uri; +set $cache_blot_folder_index /$host/$scheme/temporary$request_uri/index.html; # This is used to determine whether the server is handling # requests, don't remove it unless you change monit.rc too! @@ -14,8 +15,15 @@ location = /health { } location / { + add_header 'Cache-Hit' 'true-permanent' always; + add_header 'Cache-Control' 'max-age=31536000' always; + try_files $cache_permanent_folder @temporary; +} + +location @temporary { + add_header 'Cache-Control' '' always; add_header 'Cache-Hit' 'true' always; - try_files $cache $cache_index @blot; + try_files $cache_blot_folder $cache_blot_folder_index @blot; } location @blot { diff --git a/config/nginx/blot-site.conf b/config/nginx/blot-site.conf index 422b8e0ff41..0bc085a3c3e 100644 --- a/config/nginx/blot-site.conf +++ b/config/nginx/blot-site.conf @@ -4,8 +4,9 @@ root /cache; # use $request_uri if you want the query string also # use $uri if you don't -set $cache_blot_folder /$host$uri; -set $cache_blot_folder_index /$host$uri/index.html; +set $cache_permanent_folder /$host/$scheme/permanent$request_uri; +set $cache_blot_folder /$host/$scheme/temporary$request_uri; +set $cache_blot_folder_index /$host/$scheme/temporary$request_uri/index.html; # This is used to determine whether the server is handling # requests, don't remove it unless you change monit.rc too! @@ -24,6 +25,13 @@ if ($cookie_connect.sid) { } location / { + add_header 'Cache-Hit' 'true-permanent' always; + add_header 'Cache-Control' 'max-age=31536000' always; + try_files $cache_permanent_folder @temporary; +} + +location @temporary { + add_header 'Cache-Control' '' always; add_header 'Cache-Hit' 'true' always; try_files $cache_blot_folder $cache_blot_folder_index @blot; }