1. The problem I’m having:
The basic idea here is: I want to setup a typical reverse proxy but also want to be able to serve TLS-termating requests that arrive destined anywhere on :443
. Use case would be Caddy sitting in between a cloud load balancer and an application backend: I want the load balancer to be able to hit the instance’s routable IP address, but the load balancer may not know about what hostname the backend instance is serving: it just wants to see a response (either HTTP or HTTPS) after making the request.
I strongly suspect this is SNI-related, since I can invoke curl
with --resolve
and get a response back for any hostname - but the hostname has to be there first.
I can also get an internal wildcard name for the IP address - as long as its’ listed in a host
matcher. But the trick here is that the instance doesn’t know how the upstream load balancer is going to hit it.
The sort of things that I expect might make what I want work, but haven’t so far:
- Using
default_sni
,fallback_sni
, orstrict_sni_host insecure_off
- Ensuring that a
host *
matcher is set
2. Error messages and/or full log output:
What I get back from curl
:
$ curl -k https://127.0.0.1
curl: (35) OpenSSL/3.0.14: error:0A000438:SSL routines::tlsv1 alert internal error
What I want to see - note I can trick this into working by using --resolve
, I assume because of SNI?
$ curl --resolve foo:443:127.0.0.1 -k https://foo
Hi
3. Caddy version:
v.2.8.4
4. How I installed and ran Caddy:
I’m isolating this behavior into a local xcaddy build (because my environment also ships the rate-limiter module).
a. System environment:
NixOS 24.05, though the smallest-reproducible-config is pretty simple and my OS/systemd/docker versions don’t directly apply here.
b. Command:
caddy run
c. Service/unit/compose file:
N/A
d. My complete Caddy config:
A few settings changed including a few SNI-related settings I tried that didn’t do much:
{
default_sni example.com
fallback_sni example.com
servers {
strict_sni_host insecure_off
}
}
*:443 {
tls internal
respond "Hi"
}