]> Lady’s Gitweb - x_status_git/blobdiff - Caddyfile
Retry without cache if loading a status fails
[x_status_git] / Caddyfile
index 03420b830e05f4eb0b4ee6cf5f21947c5067a1b9..95fed0ebb752326a97fed18094d2376987ea60b7 100644 (file)
--- a/Caddyfile
+++ b/Caddyfile
@@ -9,9 +9,14 @@ status.site.example {
                path_regexp jsonld \.jsonld$
        }
 
+       @atom {
+               path_regexp atom \.atom$
+       }
+
        @bare {
                not path_regexp /$
                not path_regexp \.jsonld$
+               not path_regexp \.atom$
        }
 
        @empty {
@@ -21,11 +26,28 @@ status.site.example {
        handle / {
                rewrite * /index.html
                header Link </about.jsonld>;rel=meta;type="application/ld+json"
+               header Link </statuses.atom>;rel=alternate;type="application/atom+xml"
+       }
+
+       @iri {
+               path_regexp matcher ^/(?P<iri>[^/:]+:[^/]+)/?$
+       }
+
+       handle @iri {
+               handle @bare {
+                       rewrite * /.lookup.xhtml
+                       header Cache-Control max-age=0
+               }
+
+               handle @slash {
+                       redir * /{re.matcher.iri}
+               }
        }
 
        handle /about {
                rewrite * /.about.html
                header Link </about.jsonld>;rel=meta;type="application/ld+json"
+               header Link </statuses.atom>;rel=alternate;type="application/atom+xml"
        }
 
        redir /about/ /about
@@ -35,12 +57,15 @@ status.site.example {
        handle /statuses {
                rewrite * /.statuses.html
                header Link </statuses.jsonld>;rel=meta;type="application/ld+json"
+               header Link </statuses.atom>;rel=alternate;type="application/atom+xml"
        }
 
        redir /statuses/ /statuses
 
        rewrite /statuses.jsonld /statuses/index.jsonld
 
+       rewrite /statuses.atom /statuses/index.atom
+
        @dated {
                path_regexp matcher ^/statuses/(?P<ym>\d{4}-\d{2})(?P<suffix>/[^/.]+)?(?:\..*|/)?$
                not path_regexp ^/statuses/index[/.]?
@@ -51,6 +76,7 @@ status.site.example {
                        handle @bare {
                                rewrite * /.topic.html
                                header Link </statuses/{re.matcher.ym}.jsonld>;rel=meta;type="application/ld+json"
+                               header Link </statuses.atom>;rel=alternate;type="application/atom+xml"
                        }
 
                        handle @slash {
@@ -60,12 +86,17 @@ status.site.example {
                        handle @jsonld {
                                rewrite * /statuses/{re.matcher.ym}/index.jsonld
                        }
+
+                       handle @atom {
+                               rewrite * /statuses/{re.matcher.ym}/index.atom
+                       }
                }
 
                handle {
                        handle @bare {
                                rewrite * /.status.html
                                header Link </statuses/{re.matcher.ym}.jsonld>;rel=meta;type="application/ld+json"
+                               header Link </statuses.atom>;rel=alternate;type="application/atom+xml"
                        }
 
                        handle @slash {
@@ -93,6 +124,7 @@ status.site.example {
                        handle @bare {
                                rewrite * /.topic.html
                                header Link </topics/{re.matcher.topic}.jsonld>;rel=meta;type="application/ld+json"
+                               header Link </topics/{re.matcher.topic}.atom>;rel=alternate;type="application/atom+xml"
                        }
 
                        handle @slash {
@@ -102,12 +134,17 @@ status.site.example {
                        handle @jsonld {
                                rewrite * /topics/{re.matcher.topic}/index.jsonld
                        }
+
+                       handle @atom {
+                               rewrite * /topics/{re.matcher.topic}/index.atom
+                       }
                }
 
                handle {
                        handle @bare {
                                rewrite * /.status.html
                                header Link </topics/{re.matcher.topic}.jsonld>;rel=meta;type="application/ld+json"
+                               header Link </topics/{re.matcher.topic}.atom>;rel=alternate;type="application/atom+xml"
                        }
 
                        handle @slash {
@@ -116,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.025681 seconds and 4 git commands to generate.