Hello,
1. The problem I’m having:
I’m trying to set up a server behind Caddy using Docker, with Cloudflare DNS for TLS. Locally everything works fine (with a local mediaserver name using tls internal), but when I access the remote domain (https://server.mydomain.com:32500) I get a blank page — the response has HTTP 200 status, it says the cert is OK but the content length is 0 and no body is returned. Port is open and forwarded via my router, I can see it hitting caddy:
Log:
caddy | {"level":"debug","ts":1753694259.6074917,"logger":"tls.handshake","msg":"default certificate selection results","identifier":"*.mydomain.com","subjects":["*.mydomain.com"],"managed":true,"issuer_key":"acme-v02.api.letsencrypt.org-directory","hash":"X"}
caddy | {"level":"debug","ts":1753694259.6075118,"logger":"tls.handshake","msg":"matched certificate in cache","remote_ip":"192.168.5.1","remote_port":"51394","subjects":["*.mydomain.com"],"managed":true,"expiration":1761465176,"hash":"X"}
2. Error messages and/or full log output:
Blank page
3. Caddy version:
v2.10.0 h1:fonubSaQKF1YANl8TXqGcn4IbIRUDdfAkpcsfI/vX5U=
4. How I installed and ran Caddy:
docker-compose.yaml:
version: '3'
services:
caddy:
image: ghcr.io/caddybuilds/caddy-cloudflare:latest
container_name: caddy
ports:
- "8096:8096" # local
- "32500:443" # external
volumes:
- ./Caddyfile:/etc/caddy/Caddyfile
- caddy_data:/data
- caddy_config:/config
environment:
- CADDY_DEBUG=true
- CLOUDFLARE_API_TOKEN=${CLOUDFLARE_API_TOKEN}
restart: unless-stopped
networks:
- web
networks:
web:
volumes:
caddy_data:
caddy_config:
a. System environment:
ubuntu
b. Command:
docker compose up
d. My complete Caddy config:
{
debug
email myemail@gmail.com
}
https://mediaserver:8096 {
respond "Hello server" 200
tls internal
}
server.mydomain.com:443 {
respond "Hello server" 200
tls {
dns cloudflare {env.CLOUDFLARE_API_TOKEN}
}
}
Thank you for your help!