]> Lady’s Gitweb - x_status_git/blob - Caddyfile
Add sample Caddyfile
[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 @bare {
13 not path_regexp /$
14 not path_regexp \.jsonld$
15 }
16
17 @empty {
18 expression {re.matcher.suffix} == ""
19 }
20
21 handle /about {
22 rewrite * /.about.html
23 header Link </about.jsonld>;rel=meta;type="application/ld+json"
24 }
25
26 redir /about/ /about
27
28 rewrite /about.jsonld /about/index.jsonld
29
30 handle /statuses {
31 rewrite * /.statuses.html
32 header Link </statuses.jsonld>;rel=meta;type="application/ld+json"
33 }
34
35 @statusroot {
36 path_regexp matcher ^/statuses/(?P<path>.*)
37 not path_regexp ^/statuses/index\.
38 }
39
40 handle @statusroot {
41 handle /statuses/ {
42 redir * /statuses
43 }
44
45 handle {
46 redir * /{re.matcher.path}
47 }
48 }
49
50 rewrite /statuses.jsonld /statuses/index.jsonld
51
52 @dated {
53 path_regexp matcher ^/(?P<ym>\d{4}-\d{2})(?P<suffix>/[^/.]+)?(?:\..*|/)?$
54 }
55
56 handle @dated {
57 handle @empty {
58 handle @bare {
59 rewrite * /.topic.html
60 header Link </{re.matcher.ym}.jsonld>;rel=meta;type="application/ld+json"
61 }
62
63 handle @slash {
64 redir * /{re.matcher.ym}
65 }
66
67 handle @jsonld {
68 rewrite * /{re.matcher.ym}/index.jsonld
69 }
70 }
71
72 handle {
73 handle @bare {
74 rewrite * /.status.html
75 header Link </{re.matcher.ym}.jsonld>;rel=meta;type="application/ld+json"
76 }
77
78 handle @slash {
79 redir * /{re.matcher.ym}{re.matcher.suffix}
80 }
81 }
82 }
83
84 handle /topics {
85 rewrite * /.topics.html
86 header Link </topics.jsonld>;rel=meta;type="application/ld+json"
87 }
88
89 redir /topics/ /topics
90
91 rewrite /topics.jsonld /topics/index.jsonld
92
93 @topics {
94 path_regexp matcher ^/(?:topics/(?P<topic>[0-9A-Za-z_-]+))(?P<suffix>/[^/.]+)?(?:\..*|/)?$
95 not path_regexp ^/topics/index[/.]?
96 }
97
98 handle @topics {
99 handle @empty {
100 handle @bare {
101 rewrite * /.topic.html
102 header Link </topics/{re.matcher.topic}.jsonld>;rel=meta;type="application/ld+json"
103 }
104
105 handle @slash {
106 redir * /topics/{re.matcher.topic}
107 }
108
109 handle @jsonld {
110 rewrite * /topics/{re.matcher.topic}/index.jsonld
111 }
112 }
113
114 handle {
115 handle @bare {
116 rewrite * /.status.html
117 header Link </topics/{re.matcher.topic}.jsonld>;rel=meta;type="application/ld+json"
118 }
119
120 handle @slash {
121 redir * /topics/{re.matcher.topic}{re.matcher.suffix}
122 }
123 }
124 }
125
126 header Access-Control-Allow-Origin "*"
127
128 file_server {
129 index index.xml index.xhtml index.html index.rdf index.txt
130 }
131 }
This page took 0.070583 seconds and 5 git commands to generate.