]> Lady’s Gitweb - x_status_git/commitdiff
Add sample Caddyfile 0.1.2
authorLady <redacted>
Sun, 18 Sep 2022 08:26:03 +0000 (01:26 -0700)
committerLady <redacted>
Fri, 15 Dec 2023 03:55:43 +0000 (22:55 -0500)
Caddyfile [new file with mode: 0644]
README.markdown

diff --git a/Caddyfile b/Caddyfile
new file mode 100644 (file)
index 0000000..b4bcbff
--- /dev/null
+++ b/Caddyfile
@@ -0,0 +1,131 @@
+status.site.example {
+       root * /home/USERNAME/status.site.example/public
+
+       @slash {
+               path_regexp slash /$
+       }
+
+       @jsonld {
+               path_regexp jsonld \.jsonld$
+       }
+
+       @bare {
+               not path_regexp /$
+               not path_regexp \.jsonld$
+       }
+
+       @empty {
+               expression {re.matcher.suffix} == ""
+       }
+
+       handle /about {
+               rewrite * /.about.html
+               header Link </about.jsonld>;rel=meta;type="application/ld+json"
+       }
+
+       redir /about/ /about
+
+       rewrite /about.jsonld /about/index.jsonld
+
+       handle /statuses {
+               rewrite * /.statuses.html
+               header Link </statuses.jsonld>;rel=meta;type="application/ld+json"
+       }
+
+       @statusroot {
+               path_regexp matcher ^/statuses/(?P<path>.*)
+               not path_regexp ^/statuses/index\.
+       }
+
+       handle @statusroot {
+               handle /statuses/ {
+                       redir * /statuses
+               }
+
+               handle {
+                       redir * /{re.matcher.path}
+               }
+       }
+
+       rewrite /statuses.jsonld /statuses/index.jsonld
+
+       @dated {
+               path_regexp matcher ^/(?P<ym>\d{4}-\d{2})(?P<suffix>/[^/.]+)?(?:\..*|/)?$
+       }
+
+       handle @dated {
+               handle @empty {
+                       handle @bare {
+                               rewrite * /.topic.html
+                               header Link </{re.matcher.ym}.jsonld>;rel=meta;type="application/ld+json"
+                       }
+
+                       handle @slash {
+                               redir * /{re.matcher.ym}
+                       }
+
+                       handle @jsonld {
+                               rewrite * /{re.matcher.ym}/index.jsonld
+                       }
+               }
+
+               handle {
+                       handle @bare {
+                               rewrite * /.status.html
+                               header Link </{re.matcher.ym}.jsonld>;rel=meta;type="application/ld+json"
+                       }
+
+                       handle @slash {
+                               redir * /{re.matcher.ym}{re.matcher.suffix}
+                       }
+               }
+       }
+
+       handle /topics {
+               rewrite * /.topics.html
+               header Link </topics.jsonld>;rel=meta;type="application/ld+json"
+       }
+
+       redir /topics/ /topics
+
+       rewrite /topics.jsonld /topics/index.jsonld
+
+       @topics {
+               path_regexp matcher ^/(?:topics/(?P<topic>[0-9A-Za-z_-]+))(?P<suffix>/[^/.]+)?(?:\..*|/)?$
+               not path_regexp ^/topics/index[/.]?
+       }
+
+       handle @topics {
+               handle @empty {
+                       handle @bare {
+                               rewrite * /.topic.html
+                               header Link </topics/{re.matcher.topic}.jsonld>;rel=meta;type="application/ld+json"
+                       }
+
+                       handle @slash {
+                               redir * /topics/{re.matcher.topic}
+                       }
+
+                       handle @jsonld {
+                               rewrite * /topics/{re.matcher.topic}/index.jsonld
+                       }
+               }
+
+               handle {
+                       handle @bare {
+                               rewrite * /.status.html
+                               header Link </topics/{re.matcher.topic}.jsonld>;rel=meta;type="application/ld+json"
+                       }
+
+                       handle @slash {
+                               redir * /topics/{re.matcher.topic}{re.matcher.suffix}
+                       }
+               }
+       }
+
+       header Access-Control-Allow-Origin "*"
+
+       file_server {
+               index index.xml index.xhtml index.html index.rdf index.txt
+       }
+}
index a0f841366a0c919f49d79f265640fcae53652b9c..657527d5751aa95bd7aff9c37524c166ab820725 100644 (file)
@@ -71,7 +71,9 @@ You’ll need to supply some variables there, too :—
 ## Server Configuration
 
 Your server should be configured to serve the following files from the
-  provided `PUBLIC_DIRECTORY` in response to the following requests :—
+  provided `PUBLIC_DIRECTORY` in response to the following requests.
+For people using Caddy to serve their content, a sample `Caddyfile` is
+  included in this repository.
 
 ### H·T·M·L responses
 
This page took 0.027096 seconds and 4 git commands to generate.