1. The problem I’m having:
I want to run 2 instances of caddy; one that is locally available for my clients on lan, and one that is publicly available for my clients on the internet. I want to access everything under the same dns name. In an ideal world, I would like to do something like this:
Caddyfile: prod
some.service.tld {
reverse_proxy tunneled_connection_to_lab_instance
}
Caddyfile: lab
some.service.tld {
reverse_proxy the_real_backend_service:some-port
}
where the wan instance proxies everything to the lan instance, instead of the wan instance directly accessing all the backend services. What’s the best way to achieve this? Is this simple config possible?
2. Error messages and/or full log output:
N/A
3. Caddy version:
Both hosts are running v2.10.2 h1:g/gTYjGMD0dec+UgMw8SnfmJ3I9+M2TdvoRL/Ovu6U8=, pulled from ghcr.io/caddybuilds/caddy-cloudflare:latest
4. How I installed and ran Caddy:
Services in docker compose projects
a. System environment:
Both hosts are amd64. Both caddy instances are running on docker.
c. Service/unit/compose file:
host lab:
services:
caddy:
container_name: caddy
image: ghcr.io/caddybuilds/caddy-cloudflare:latest
restart: unless-stopped
ports:
- "80:80"
- "443:443"
volumes:
- "./Caddyfile:/etc/caddy/Caddyfile:ro"
- "./caddy_data:/data"
- "./caddy_config:/config"
environment:
- CLOUDFLARE_API_TOKEN=(redacted)
host prod:
services:
caddy:
container_name: caddy
image: ghcr.io/caddybuilds/caddy-cloudflare:latest
restart: unless-stopped
ports:
- "80:80"
- "443:443"
volumes:
- "./Caddyfile:/etc/caddy/Caddyfile:ro"
- "./caddy_data:/data"
- "./caddy_config:/config"
environment:
- CLOUDFLARE_API_TOKEN=(redacted)
d. My complete Caddy config:
N/A