From 4913508ea6e710fd59638686ca6ac14cda66a050 Mon Sep 17 00:00:00 2001 From: Fabian Date: Fri, 26 Jul 2024 10:25:49 +0200 Subject: [PATCH] Add Cache-Control "public,max-age=0,must-revalidate" to index.html in SPA example Add the Cache-Control "public,max-age=0,must-revalidate" for index.html header to the SPA example. In SPAs the index.html must be prevented from being cached, in the index.html the (hashed) javascript and css file are referenced (these can be cached becaused they get a new random suffix everytime they are built) --- src/docs/markdown/caddyfile/patterns.md | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/docs/markdown/caddyfile/patterns.md b/src/docs/markdown/caddyfile/patterns.md index adcba9c..cbb567a 100644 --- a/src/docs/markdown/caddyfile/patterns.md +++ b/src/docs/markdown/caddyfile/patterns.md @@ -218,7 +218,12 @@ A typical SPA config usually looks something like this: example.com { root * /srv encode gzip - try_files {path} /index.html + route { + try_files {path} /index.html + header /index.html { + Cache-Control "public,max-age=0,must-revalidate" + } + } file_server } ```