]> git.ardis.lu - git.ardis.lu/commitdiff
Add Cache-Control to response headers
authorArdis Lu <ardisglu@gmail.com>
Sat, 4 Apr 2026 08:04:29 +0000 (01:04 -0700)
committerArdis Lu <ardisglu@gmail.com>
Sat, 4 Apr 2026 08:04:29 +0000 (01:04 -0700)
This header asks the requester to cache like this:

0-1 hour: serve cached page
1 hour-7 days: serve cached page and revalidate in the background
7 days+: get and serve fresh page (no cache)

Not all web browsers (e.g., Google Chrome) will respect this header. It is mainly for CDNs or other layers I may decide to put in front of Caddy later.

etc/caddy/Caddyfile

index 7c1b8cc8579425167c8f9f102825072f3eeb7109..cb4fc0649c6e9c6f9f97fe5ff0a1fb2662b46109 100644 (file)
@@ -4,6 +4,7 @@ git.ardis.lu {
     Cross-Origin-Opener-Policy same-origin
     Cross-Origin-Embedder-Policy require-corp
     X-Content-Type-Options nosniff
+    Cache-Control "max-age=3600, stale-while-revalidate=604800, stale-if-error=604800"
   }
 
   root /usr/share/gitweb
This page took 0.046389 seconds and 4 git commands to generate.