Files
git-pages/conf/Caddyfile
T
Catherine a10e28210a Enable h2c:// (cleartext HTTP/2) protocol on all http:// sockets.
This allows git-pages and Caddy to efficiently use the same connection
for many pipelined requests, which I hope will reduce contention when
some bot decides to send fifty requests in the same millisecond.

This commit also changes built-in Caddy configuration to use HTTP/2
cleartext only when talking to the backend.
2025-09-21 03:36:14 +00:00

69 lines
980 B
Caddyfile

{
persist_config off
log {
output stderr
level WARN
exclude http.auto_https
format console {
time_key ""
}
}
metrics {
per_host
}
storage s3 {
host "{env.S3_ENDPOINT}"
access_id "{env.S3_ACCESS_KEY_ID}"
secret_key "{env.S3_SECRET_ACCESS_KEY}"
bucket "{env.S3_BUCKET}"
prefix "ssl"
}
email {env.ACME_EMAIL}
auto_https disable_redirects
on_demand_tls {
permission http http://{$GIT_PAGES_ADDRESS:localhost}:3001
}
servers :80 {
name http
protocols h1 h2c
}
servers :443 {
name https
protocols h1 h2
}
servers :2002 {
name health
protocols h1
}
}
http:// {
@get method GET
redir @get https://{host}{uri} 301
# initial PUT/POST for a new domain has to happen over HTTP
reverse_proxy h2c://{$GIT_PAGES_ADDRESS:localhost}:3000
}
https:// {
tls {
on_demand
}
encode
reverse_proxy h2c://{$GIT_PAGES_ADDRESS:localhost}:3000
}
http://localhost:2002 {
reverse_proxy h2c://{$GIT_PAGES_ADDRESS:localhost}:3002
}