{
	admin off
	servers {
		protocols h1 h2
	}
}

{$FETCHML_DOMAIN} {
	encode gzip

	tls /etc/caddy/ssl/cert.pem /etc/caddy/ssl/key.pem

	header {
		-Server
		X-Frame-Options "DENY"
		X-Content-Type-Options "nosniff"
		Referrer-Policy "strict-origin-when-cross-origin"
		Strict-Transport-Security "max-age=31536000; includeSubDomains; preload"
		Content-Security-Policy "default-src 'self'; base-uri 'self'; frame-ancestors 'none'"
	}

	@admin path /admin/*
	@admin_private remote_ip private_ranges
	handle @admin {
		respond @admin_private 404
		respond 404
	}

	handle /health {
		reverse_proxy api-server:9101
	}

	handle /ws* {
		reverse_proxy api-server:9101
	}

	handle /api/* {
		reverse_proxy api-server:9101
	}

	handle {
		respond 404
	}
}
