Closed Lingxi-Li closed 1 year ago
It's not a contradiction. (But this is a good question.) A site block name in the Caddyfile serves three purposes (somewhat regrettably):
In most cases, these are correlate and align identically as long as we assume the default port(s) of 80/443: you can tell the server you have example.com
and it will listen on 443, get a cert for example.com
, and serve HTTP requests with a Host header of example.com
accordingly.
But when you're running a forward proxy, the Host
header can contain basically anything, so you need to listen on :443
to not black-hole those HTTP requests (no. 3). But without a domain name it can't get a cert (no. 2), so you need to tell which certificate to serve in the TLS handshake. Hence, both :443, example.com
.
The doc says
Could you help further clarify? I thought
example.com
alone should have both80
and443
covered. The magic:443, example.com
looks a self contradiction to me.