summaryrefslogtreecommitdiff
path: root/caddy/Caddyfile
blob: b7344b0a630cef28c6913cb4eab9090752c5befd (plain)
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
61
{
	email [email protected]
	log {
		output stdout
		format console
	}
	auto_https disable_redirects
}

(strip-www) {
	redir https://{args.0}{uri}
}

(common_domain) {
	encode gzip
	handle {
		try_files {path} {path}/
	}
	handle_errors {
		@404 {
			expression {http.error.status_code} == 404
		}
		rewrite @404 /404.html
		file_server
	}
	log {
		output file /var/log/caddy/{args.0}-access.log {
			roll_keep 5
			roll_keep_for 720h
		}
		format console
	}
}

(no_embeds) {
	header /{args.0} X-Frame-Options DENY
}

(container_proxy) {
	handle_path /{args.0}/* {
		reverse_proxy {args.1}
	}
}

www.{$DOMAIN:localhost} {
	import strip-www {$DOMAIN:localhost}
}

{$DOMAIN:localhost} {
	root * {$CADDY_ROOT:/var/www}
	import common_domain {$DOMAIN:localhost}

	file_server browse {
		index index.html
		hide .* LICENSE README.md
	}

	import no_embeds lul.html
	import container_proxy api {$API_HOST:api}:80
	redir /chris2 /files/chris.webp permanent
}