]> Lady’s Gitweb - x_status_git/blob - Caddyfile
a430aae06c9d8691e330c11e48c60b98528645ba
[x_status_git] / 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 }
40
41 handle @slash {
42 redir * /{re.matcher.iri}
43 }
44 }
45
46 handle /about {
47 rewrite * /.about.html
48 header Link </about.jsonld>;rel=meta;type="application/ld+json"
49 header Link </statuses.atom>;rel=alternate;type="application/atom+xml"
50 }
51
52 redir /about/ /about
53
54 rewrite /about.jsonld /about/index.jsonld
55
56 handle /statuses {
57 rewrite * /.statuses.html
58 header Link </statuses.jsonld>;rel=meta;type="application/ld+json"
59 header Link </statuses.atom>;rel=alternate;type="application/atom+xml"
60 }
61
62 redir /statuses/ /statuses
63
64 rewrite /statuses.jsonld /statuses/index.jsonld
65
66 rewrite /statuses.atom /statuses/index.atom
67
68 @dated {
69 path_regexp matcher ^/statuses/(?P<ym>\d{4}-\d{2})(?P<suffix>/[^/.]+)?(?:\..*|/)?$
70 not path_regexp ^/statuses/index[/.]?
71 }
72
73 handle @dated {
74 handle @empty {
75 handle @bare {
76 rewrite * /.topic.html
77 header Link </statuses/{re.matcher.ym}.jsonld>;rel=meta;type="application/ld+json"
78 header Link </statuses.atom>;rel=alternate;type="application/atom+xml"
79 }
80
81 handle @slash {
82 redir * /statuses/{re.matcher.ym}
83 }
84
85 handle @jsonld {
86 rewrite * /statuses/{re.matcher.ym}/index.jsonld
87 }
88
89 handle @atom {
90 rewrite * /statuses/{re.matcher.ym}/index.atom
91 }
92 }
93
94 handle {
95 handle @bare {
96 rewrite * /.status.html
97 header Link </statuses/{re.matcher.ym}.jsonld>;rel=meta;type="application/ld+json"
98 header Link </statuses.atom>;rel=alternate;type="application/atom+xml"
99 }
100
101 handle @slash {
102 redir * /statuses/{re.matcher.ym}{re.matcher.suffix}
103 }
104 }
105 }
106
107 handle /topics {
108 rewrite * /.topics.html
109 header Link </topics.jsonld>;rel=meta;type="application/ld+json"
110 }
111
112 redir /topics/ /topics
113
114 rewrite /topics.jsonld /topics/index.jsonld
115
116 @topics {
117 path_regexp matcher ^/topics/(?P<topic>[0-9A-Za-z_-]+)(?P<suffix>/[^/.]+)?(?:\..*|/)?$
118 not path_regexp ^/topics/index[/.]?
119 }
120
121 handle @topics {
122 handle @empty {
123 handle @bare {
124 rewrite * /.topic.html
125 header Link </topics/{re.matcher.topic}.jsonld>;rel=meta;type="application/ld+json"
126 header Link </topics/{re.matcher.topic}.atom>;rel=alternate;type="application/atom+xml"
127 }
128
129 handle @slash {
130 redir * /topics/{re.matcher.topic}
131 }
132
133 handle @jsonld {
134 rewrite * /topics/{re.matcher.topic}/index.jsonld
135 }
136
137 handle @atom {
138 rewrite * /topics/{re.matcher.topic}/index.atom
139 }
140 }
141
142 handle {
143 handle @bare {
144 rewrite * /.status.html
145 header Link </topics/{re.matcher.topic}.jsonld>;rel=meta;type="application/ld+json"
146 header Link </topics/{re.matcher.topic}.atom>;rel=alternate;type="application/atom+xml"
147 }
148
149 handle @slash {
150 redir * /topics/{re.matcher.topic}{re.matcher.suffix}
151 }
152 }
153 }
154
155 header Access-Control-Allow-Origin "*"
156
157 file_server {
158 index index.xml index.xhtml index.html index.rdf index.txt
159 }
160 }
This page took 0.052741 seconds and 3 git commands to generate.