{
	email {$ACME_EMAIL}
}

{$WORKSHARE_DOMAIN} {
	# Maps can be 20 MB (40 MB with interior); allow some room. Matches MAX_BODY_BYTES in src/http.js.
	request_body {
		max_size 48MB
	}

	header {
		Strict-Transport-Security "max-age=31536000; includeSubDomains"
		X-Content-Type-Options nosniff
		-Server
	}

	# Push updates (text/event-stream) are passed through unbuffered by Caddy automatically; the server pings every
	# 25 s, well inside read_timeout.
	reverse_proxy workshare:8080 {
		# Caddy replaces any X-Forwarded-For the client sent with the real address (it trusts no upstream by default),
		# so WORKSHARE_PROXY_HOPS=1 is correct here.
		transport http {
			read_timeout 5m
			write_timeout 5m
			dial_timeout 5s
		}
		health_uri /ready
		health_interval 15s
	}

	log {
		output stdout
		format json
	}
}
