How to configure caddy as a wildcard reverse proxy?

Hi,

I’m trying to place caddy in front of an apache, which does only HTTP serving.
What I’m struggling with is how to set up caddy as a wildcard proxy. I would like to serve all vhosts (no matter what comes in, using on demand TLS) without listing all the vhosts one by one and proxy anything to localhost:8888 to apache.
Is this possible at all?

BTW, I could achieve something similar with:

*, *.*, *.*.*, *.*.*.* {
proxy / 127.0.0.1:8888
tls {
    max_certs 10
}
}

But it seems pretty ugly…

Just use an empty hostname and specify only the port:

:443 {
   tls {
       max_certs 10
   }
   proxy / 127.0.0.1:8888
}
1 Like

Per the Caddyfile spec, you can specify as few as one part of a URL as a valid site label:

https://caddyserver.com/docs/http-caddyfile#addresses

So any of https://, :443, /, or any combination of them would be totally host-agnostic!

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.