Commit 3002b7c
Changed files (1)
nginx
nginx/nginx.conf
@@ -32,10 +32,14 @@ http {
include etag.map;
}
+ map $uri $cachecontrol {
+ default "public, s-maxage=31536000, stale-if-error=3600";
+ "~^/style\.min\..*\.css$" "public, max-age=31536000, s-maxage=31536000, stale-if-error=3600, immutable";
+ }
+
server {
listen 172.16.0.2:80 default_server;
-
location / {
gzip_vary on;
gzip_static on;
@@ -56,13 +60,12 @@ http {
add_header Content-Security-Policy "default-src 'none'; style-src 'self'; img-src 'self'; base-uri 'none'; require-trusted-types-for 'script';";
include client-side-security.inc;
-
etag off;
if ($hash_etag != "") {
add_header ETag $hash_etag always;
# In theory the s-maxage should cover most cases, the SIE is just
# to cover soft-purge followed by origin issue
- add_header Cache-Control "public, s-maxage=31536000, stale-if-error=3600";
+ add_header Cache-Control $cachecontrol;
add_header Surrogate-Key "blog";
# etag is enough, let's not confuse stuff with last-modified
add_header Last-Modified "";
@@ -106,7 +109,7 @@ http {
etag off;
if ($hash_etag != "") {
add_header ETag $hash_etag always;
- add_header Cache-Control "public, s-maxage=31536000, stale-if-error=3600";
+ add_header Cache-Control $cachecontrol;
add_header Surrogate-Key "git";
add_header Last-Modified "";
add_header Content-Security-Policy "default-src 'none'; style-src 'self' 'unsafe-inline'; img-src 'self'; base-uri 'none'; require-trusted-types-for 'script';";