-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathCaddyfile
More file actions
60 lines (51 loc) · 972 Bytes
/
Copy pathCaddyfile
File metadata and controls
60 lines (51 loc) · 972 Bytes
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
# https://github.com/dbohdan/caddy-markdown-site
# Copyright (c) 2021, 2025 D. Bohdan.
# License: MIT.
http://localhost:8080 {
root * demo
encode gzip
file_server
templates
@templates {
path /templates/*
not path /templates/*.css /templates/*.js
}
handle @templates {
error 403
}
@markdown {
path_regexp \.md$
}
handle @markdown {
rewrite * /templates/index.html
}
@markdown_exists {
file {path}.md
}
handle @markdown_exists {
map {path} {caddy_markdown_site.append_to_path} {
default extension
}
rewrite * /templates/index.html
}
handle_errors {
file_server
templates
@markdown_index_exists_404 {
file {path}/index.md
expression `{http.error.status_code} == 404`
}
handle @markdown_index_exists_404 {
map {path} {caddy_markdown_site.append_to_path} {
default index
}
file_server {
status 200
}
rewrite * /templates/index.html
}
handle {
rewrite * /templates/error.html
}
}
}