about summary refs log tree commit diff
path: root/Caddyfile
blob: 4994c5b51607a4b6af52a0c0a1cb2a8df7ea8b82 (plain) (blame)
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
# vim: noet ts=2 sw=2
{
	admin off
	auto_https off
	http_port {$CADDY_HTTP_PORT:1414}
}

http:// {
	encode zstd gzip

	handle /healthz {
		respond OK 200
	}

	handle_errors {
		@404 expression {http.error.status_code} == 404
		rewrite @404 /site/404.html
		file_server
	}

	@valid_paths {
		path /
		path /~*
		path /humans.txt
		path /index.html
		path /robots.txt
		path /links/*
		path /media/*
		path /site/*
	}
	handle @valid_paths {
		root .
		try_files {path} {path}/index.html {path}.html =404
		file_server
	}

	# catch all
	respond 404

	log {
		format filter {
			wrap console {
				time_format wall_milli
				level_format color
			}
			fields {
				common_log delete
				request>headers>Accept-Encoding delete
				request>headers>Accept-Language delete
				request>headers>Connection delete
				request>headers>Authorization delete
				request>remote_addr ip_mask {
					ipv4 24
					ipv6 32
				}
			}
		}
	}
}