From 51028d36b1fdb1be19b95354146a4e8ea6b55915 Mon Sep 17 00:00:00 2001 From: Grant Limberg Date: Wed, 28 Aug 2024 17:10:05 -0700 Subject: [PATCH] add better caching of assets for docs site can cache fairly javascript and images fairly aggressively as they're all hashed on build --- nginx.conf | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/nginx.conf b/nginx.conf index 653dbbe..0254956 100644 --- a/nginx.conf +++ b/nginx.conf @@ -9,6 +9,28 @@ server { # Otherwise it strips off the scheme & port number. absolute_redirect off; + location ~* ^\/assets\/(css|js)\/.+\.(css|less|js)$ { + add_header Last-Modified $date_gmt; + add_header Cache-Control 'public, max-age=86400'; + add_header X-Frame-Options "SAMEORIGIN" always; + if_modified_since before; + etag on; + } + + location ~* \.(jpg|jpeg|png|svg|gif|ico|swf|eot|ttf|woff|woff2|ot) { + add_header Last-Modified $date_gmt; + add_header Cache-Control 'public, max-age=86400'; + add_header X-Frame-Options "SAMEORIGIN" always; + if_modified_since before; + etag on; + } + + location ~* \.(html)$ { + etag on; + add_header Cache-Control "no-cache"; + add_header X-Frame-Options "SAMEORIGIN" always; + } + location ~ ^/zerotier/microsegmentation(/?)$ { return 301 /microsegmentation; }