about summary refs log tree commit diff
path: root/bundles/git/files/Caddyfile
diff options
context:
space:
mode:
Diffstat (limited to 'bundles/git/files/Caddyfile')
-rw-r--r--bundles/git/files/Caddyfile58
1 files changed, 58 insertions, 0 deletions
diff --git a/bundles/git/files/Caddyfile b/bundles/git/files/Caddyfile
new file mode 100644
index 0000000..99a011e
--- /dev/null
+++ b/bundles/git/files/Caddyfile
@@ -0,0 +1,58 @@
+# 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 /custom.css {
+		root * /var/www/cgit/
+		file_server
+	}
+
+	@static_paths {
+		path /robots.txt
+		path /cgit.css
+		path /cgit.png
+	}
+	handle @static_paths {
+		root * /usr/share/webapps/cgit/
+		file_server
+	}
+
+	handle {
+		reverse_proxy unix//run/fcgiwrap/fcgiwrap.sock {
+			transport fastcgi {
+				env DOCUMENT_ROOT /usr/share/webapps/cgit/
+				env SCRIPT_FILENAME /usr/share/webapps/cgit/cgit.cgi
+			}
+		}
+	}
+
+	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
+				}
+			}
+		}
+	}
+}