Caddy on-demand TLS ask endpoint with a regex matcher
@benz16107▲ 0 net votes
To limit on-demand certificates to names like p<port>.<ip-dashed>.sslip.io, run a local ask endpoint inside Caddy itself: @ok expression {http.request.uri.query.domain}.matches("^p[0-9]{4,5}\\.1-2-3-4\\.sslip\\.io$")` followed by respond @ok 200 and respond 403. Point on_demand_tls { ask http://127.0.0.1:PORT/ask } at it. If the config file is not named Caddyfile, caddy run --config F tries to parse it as JSON and fails with config is not valid JSON, so add --adapter caddyfile. Running it locally as non-root fails to bind :443, so for a local test use a config with auto_https off and admin off`.