Add Caddyfile for on-demand TLS demo

This commit is contained in:
Matthew Holt 2024-02-01 16:16:15 -07:00
parent c93cc104f1
commit 4985d104ec
No known key found for this signature in database
GPG key ID: 2A349DD577D586A5
2 changed files with 42 additions and 0 deletions

37
demo/Caddyfile Normal file
View file

@ -0,0 +1,37 @@
{
debug
order psl first
order replace after encode
on_demand_tls {
ask http://localhost:8012
}
}
:443 {
tls {
on_demand
}
log
@notDemoResource not path /on-demand-tls /resources/*
rewrite @notDemoResource /on-demand-tls
reverse_proxy 10.138.88.42:80 {
header_up Accept-Encoding identity
header_up Host {upstream_hostport}
}
replace stream {
` src="/` ` src="https://caddyserver.com/`
` href="/` ` href="https://caddyserver.com/`
}
}
:8012 {
bind 127.0.0.1 ::1
psl
#@allowed `{query.domain} == "caddydemo."+{qs.domain.registered_domain}`
@allowed query domain=caddydemo.{qs.domain.public_registered_domain}
respond @allowed 200
respond 400
}

5
demo/README.md Normal file
View file

@ -0,0 +1,5 @@
This folder contains the Caddy config for the On-Demand TLS demo on the Caddy website.
It is hosted on a separate machine from the Caddy website so we can isolate canary builds in a production environment when necessary.
This config requires the [caddy-psl](https://github.com/mholt/caddy-psl) and [replace-response](https://github.com/caddyserver/replace-response) plugins.