I just started using Caddy, and couldn’t find this elsewhere. I started with this:
*.bar.localhost {
reverse_proxy localhost:1337
}
And to my amazement, https://foo.bar.localhost/ resolves in Chrome, correctly proxied to http://localhost:1337! Firefox also resolves (though doesn’t accept the cert - a separate issue).
However, curl https://foo.bar.localhost reports “Cannot resolve host” (as expected).
But how does foo.bar.localhost resolve to anything in Chrome/Firefox? Does Caddy install its own DNS server somehow? Does it have some magic browser integration?
@francislavoie aha, thank you! So yeah, it turns out foo.bar.localhost resolves to 127.0.0.1 in Chrome and Firefox, and has done for quite a while - I just discovered this feature after installing Caddy, which is why I thought it was some dark magic in Caddy.
This browser override of standard DNS disturbs me a bit, but I must admit it’s convenient …