]> Lady’s Gitweb - Status/blob - Caddyfile
New status @ 2024-05-11T16:05:51-04:00
[Status] / Caddyfile
1 status.site.example {
2 root * /home/USERNAME/status.site.example/public
3
4 @slash {
5 path_regexp slash /$
6 }
7
8 @jsonld {
9 path_regexp jsonld \.jsonld$
10 }
11
12 @atom {
13 path_regexp atom \.atom$
14 }
15
16 @bare {
17 not path_regexp /$
18 not path_regexp \.jsonld$
19 not path_regexp \.atom$
20 }
21
22 @empty {
23 expression {re.matcher.suffix} == ""
24 }
25
26 handle / {
27 rewrite * /index.html
28 header Link </about.jsonld>;rel=meta;type="application/ld+json"
29 header Link </statuses.atom>;rel=alternate;type="application/atom+xml"
30 }
31
32 @iri {
33 path_regexp matcher ^/(?P<iri>[^/:]+:[^/]+)/?$
34 }
35
36 handle @iri {
37 handle @bare {
38 rewrite * /.lookup.xhtml
39 header Cache-Control max-age=0
40 }
41
42 handle @slash {
43 redir * /{re.matcher.iri}
44 }
45 }
46
47 handle /about {
48 rewrite * /.about.html
49 header Link </about.jsonld>;rel=meta;type="application/ld+json"
50 header Link </statuses.atom>;rel=alternate;type="application/atom+xml"
51 }
52
53 redir /about/ /about
54
55 rewrite /about.jsonld /about/index.jsonld
56
57 handle /statuses {
58 rewrite * /.statuses.html
59 header Link </statuses.jsonld>;rel=meta;type="application/ld+json"
60 header Link </statuses.atom>;rel=alternate;type="application/atom+xml"
61 }
62
63 redir /statuses/ /statuses
64
65 rewrite /statuses.jsonld /statuses/index.jsonld
66
67 rewrite /statuses.atom /statuses/index.atom
68
69 @dated {
70 path_regexp matcher ^/statuses/(?P<ym>\d{4}-\d{2})(?P<suffix>/[^/.]+)?(?:\..*|/)?$
71 not path_regexp ^/statuses/index[/.]?
72 }
73
74 handle @dated {
75 handle @empty {
76 handle @bare {
77 rewrite * /.topic.html
78 header Link </statuses/{re.matcher.ym}.jsonld>;rel=meta;type="application/ld+json"
79 header Link </statuses.atom>;rel=alternate;type="application/atom+xml"
80 }
81
82 handle @slash {
83 redir * /statuses/{re.matcher.ym}
84 }
85
86 handle @jsonld {
87 rewrite * /statuses/{re.matcher.ym}/index.jsonld
88 }
89
90 handle @atom {
91 rewrite * /statuses/{re.matcher.ym}/index.atom
92 }
93 }
94
95 handle {
96 handle @bare {
97 rewrite * /.status.html
98 header Link </statuses/{re.matcher.ym}.jsonld>;rel=meta;type="application/ld+json"
99 header Link </statuses.atom>;rel=alternate;type="application/atom+xml"
100 }
101
102 handle @slash {
103 redir * /statuses/{re.matcher.ym}{re.matcher.suffix}
104 }
105 }
106 }
107
108 handle /topics {
109 rewrite * /.topics.html
110 header Link </topics.jsonld>;rel=meta;type="application/ld+json"
111 }
112
113 redir /topics/ /topics
114
115 rewrite /topics.jsonld /topics/index.jsonld
116
117 @topics {
118 path_regexp matcher ^/topics/(?P<topic>[0-9A-Za-z_-]+)(?P<suffix>/[^/.]+)?(?:\..*|/)?$
119 not path_regexp ^/topics/index[/.]?
120 }
121
122 handle @topics {
123 handle @empty {
124 handle @bare {
125 rewrite * /.topic.html
126 header Link </topics/{re.matcher.topic}.jsonld>;rel=meta;type="application/ld+json"
127 header Link </topics/{re.matcher.topic}.atom>;rel=alternate;type="application/atom+xml"
128 }
129
130 handle @slash {
131 redir * /topics/{re.matcher.topic}
132 }
133
134 handle @jsonld {
135 rewrite * /topics/{re.matcher.topic}/index.jsonld
136 }
137
138 handle @atom {
139 rewrite * /topics/{re.matcher.topic}/index.atom
140 }
141 }
142
143 handle {
144 handle @bare {
145 rewrite * /.status.html
146 header Link </topics/{re.matcher.topic}.jsonld>;rel=meta;type="application/ld+json"
147 header Link </topics/{re.matcher.topic}.atom>;rel=alternate;type="application/atom+xml"
148 }
149
150 handle @slash {
151 redir * /topics/{re.matcher.topic}{re.matcher.suffix}
152 }
153 }
154 }
155
156 header {
157 Access-Control-Allow-Origin "*"
158 ?Cache-Control max-age=3600
159 }
160
161 file_server {
162 index index.xml index.xhtml index.html index.rdf index.txt
163 }
164 }
This page took 0.426842 seconds and 5 git commands to generate.