about summary refs log tree commit diff
path: root/Caddyfile
diff options
context:
space:
mode:
authorRobert Günzler <r@gnzler.io>2024-11-25 19:32:44 +0100
committerRobert Günzler <r@gnzler.io>2024-11-25 21:38:34 +0100
commitd340c58bab2f2b470da9e423bdcc3f20b99ee071 (patch)
tree802a33ad4598bb27d552866ad8e3c0045525b2fa /Caddyfile
parentcbc8ee4eb4882f7002cf15a03bbf44f6d81aa147 (diff)
downloadsite-d340c58bab2f2b470da9e423bdcc3f20b99ee071.tar.gz
add Caddyfile
Signed-off-by: Robert Günzler <r@gnzler.io>
Diffstat (limited to 'Caddyfile')
-rw-r--r--Caddyfile54
1 files changed, 54 insertions, 0 deletions
diff --git a/Caddyfile b/Caddyfile
new file mode 100644
index 0000000..785fe23
--- /dev/null
+++ b/Caddyfile
@@ -0,0 +1,54 @@
+# 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 /index.html
+		path /site/*
+		path /media/*
+		path /links/*
+	}
+	handle @valid_paths {
+		root .
+		try_files {path} {path}/index.html {path}.html =404
+		file_server
+	}
+
+	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
+				}
+			}
+		}
+	}
+}