/
Caddyfile
37 lines (31 loc) · 1.27 KB
/
Caddyfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
{$DOMAIN:http://localhost} {
root * /site
file_server
encode zstd gzip
# Cache GET responses for 10 minutes, validate async during next minute, or continue serving
# old data as-is for up to 1 hour if this server stops responding/returns errors.
@get method GET
header @get Cache-Control "public, max-age=600, stale-while-revalidate=60, stale-if-error=3600"
# Will-it-cors subpaths are SPA-only, fresh loads must go back to the start:
@will-it-cors-step path_regexp ^/will-it-cors/.+
redir @will-it-cors-step /will-it-cors/ 308
# Old URLS that are all now replaced by the new root page:
redir /toolkit / 308
redir /toolkit/ / 308
redir /mock / 308
redir /mock/ / 308
redir /view / 308
redir /view/ / 308
@view-thankyou-subpath path_regexp subpath ^/view/thank-you/(.+)
redir @view-thankyou-subpath /download/{re.subpath.1} 308
@view-subpath path_regexp subpath ^/view/(.+)
redir @view-subpath /{re.subpath.1} 308
@mock-subpath path_regexp subpath ^/mock/(.+)
redir @mock-subpath /{re.subpath.1} 308
header X-Clacks-Overhead "GNU Terry Pratchett" # https://xclacksoverhead.org
handle_errors {
@404 `{err.status_code} == 404`
rewrite @404 /404.html
file_server
}
}