]> Lady’s Gitweb - x_status_git/commitdiff
Add Cache-Control header to sample Caddyfile
authorLady <redacted>
Sat, 16 Dec 2023 22:36:14 +0000 (17:36 -0500)
committerLady <redacted>
Sat, 23 Dec 2023 20:17:52 +0000 (15:17 -0500)
Basic functionality depends on recent versions of files, although the
fact that every status needs to request the same base index implies
that some level of cacheing is desirable. A cache of one hour is a good
compromise; indices are unlikely to need to be refetched within a
single session, but are likely to be updated between sessions.

For IRI lookups, always consider the file stale to ensure that these
redirects always “work”.

Caddyfile

index a430aae06c9d8691e330c11e48c60b98528645ba..95fed0ebb752326a97fed18094d2376987ea60b7 100644 (file)
--- a/Caddyfile
+++ b/Caddyfile
@@ -36,6 +36,7 @@ status.site.example {
        handle @iri {
                handle @bare {
                        rewrite * /.lookup.xhtml
+                       header Cache-Control max-age=0
                }
 
                handle @slash {
@@ -152,7 +153,10 @@ status.site.example {
                }
        }
 
-       header Access-Control-Allow-Origin "*"
+       header {
+               Access-Control-Allow-Origin "*"
+               ?Cache-Control max-age=3600
+       }
 
        file_server {
                index index.xml index.xhtml index.html index.rdf index.txt
This page took 0.024003 seconds and 4 git commands to generate.