1. The problem I’m having:
I wish to transition from Nginx Proxy Manager over to caddy, but I seem to have an issue with using both cf origin certs (cf proxy) and let’s encrypt certs (just dns). If I pick just let’s encrypt works fine, if I pick cf it works fine, it’s just using both that has an issue.
2. Error messages and/or full log output:
PASTE OVER THIS, BETWEEN THE ``` LINES.
Please use the preview pane to ensure it looks nice.
3. Caddy version:
v2.8.4 h1:q3pe0wpBj1OcHFZ3n/1nl4V4bxBrYoSoab7rL9BMYNk=
4. How I installed and ran Caddy:
a. System environment:
Debian 6.1.99-1 (2024-07-15) x86_64 GNU/Linux
Caddy is running inside a docker container
b. Command:
docker compose up -d
c. Service/unit/compose file:
services:
caddy:
container_name: caddy
image: caddy:latest
cap_add:
- NET_ADMIN
ports:
- "50226:80"
- "60204:443"
- "60204:443/udp"
volumes:
- '${HOME}/docker-data/caddy/Caddyfile:/etc/caddy/Caddyfile'
- '${HOME}/docker-data/caddy/site:/srv'
- '${HOME}/docker-data/caddy/data:/data'
- '${HOME}/docker-data/caddy/caddy_config:/config'
- '${HOME}/docker-data/caddy/certs:/certs'
restart: unless-stopped
networks:
default:
name: caddy
external: true
d. My complete Caddy config:
books.xincept.xyz {
reverse_proxy 172.18.0.1:50224
}
air.xincept.xyz {
reverse_proxy 172.18.0.1:50212
tls /certs/xincept.xyz.pem /certs/xincept.xyz.key
}
workspace.xincept.xyz {
reverse_proxy 172.18.0.1:3010
tls /certs/xincept.xyz.pem /certs/xincept.xyz.key
}
5. Links to relevant resources:
I had asked about this a few years ago and was wondering if there was an update on this? Or how would i be able to do this with json i tried myself for a few hours and gave up, i tried using gpt and got a semi working config that only worked when i added to json file but then logs were getting spammed by lets encrypt trying to get certs for subdomains using cf origin cert. But they were showing up as lets encrypt and cf but then i wasnt able to acess it from my lan.
"automatic_https": {
"ignore_loaded_certificates": true
}
I also stumbled upon this and was wondering if it was also a potential solution?
And here are logs:
{"level":"info","ts":1728853115.0118105,"msg":"using config from file","file":"/etc/caddy/Caddyfile"}
{"level":"info","ts":1728853115.014349,"msg":"adapted config to JSON","adapter":"caddyfile"}
{"level":"warn","ts":1728853115.0143595,"msg":"Caddyfile input is not formatted; run 'caddy fmt --overwrite' to fix inconsistencies","adapter":"caddyfile","file":"/etc/caddy/Caddyfile","line":2}
{"level":"info","ts":1728853115.0152671,"logger":"admin","msg":"admin endpoint started","address":"localhost:2019","enforce_origin":false,"origins":["//localhost:2019","//[::1]:2019","//127.0.0.1:2019"]}
{"level":"info","ts":1728853115.0162508,"logger":"tls.cache.maintenance","msg":"started background certificate maintenance","cache":"0xc000495c80"}
{"level":"warn","ts":1728853115.016788,"logger":"tls","msg":"stapling OCSP","error":"no OCSP stapling for [cloudflare origin certificate *.xincept.xyz xincept.xyz]: no URL to issuing certificate"}
{"level":"info","ts":1728853115.0168664,"logger":"http.auto_https","msg":"skipping automatic certificate management because one or more matching certificates are already loaded","domain":"air.xincept.xyz","server_name":"srv0"}
{"level":"info","ts":1728853115.016874,"logger":"http.auto_https","msg":"skipping automatic certificate management because one or more matching certificates are already loaded","domain":"workspace.xincept.xyz","server_name":"srv0"}
{"level":"info","ts":1728853115.016878,"logger":"http.auto_https","msg":"skipping automatic certificate management because one or more matching certificates are already loaded","domain":"books.xincept.xyz","server_name":"srv0"}
{"level":"info","ts":1728853115.0168808,"logger":"http.auto_https","msg":"enabling automatic HTTP->HTTPS redirects","server_name":"srv0"}
{"level":"info","ts":1728853115.019041,"logger":"http","msg":"enabling HTTP/3 listener","addr":":443"}
{"level":"info","ts":1728853115.020389,"logger":"http.log","msg":"server running","name":"srv0","protocols":["h1","h2","h3"]}
{"level":"info","ts":1728853115.0204937,"logger":"http.log","msg":"server running","name":"remaining_auto_https_redirects","protocols":["h1","h2","h3"]}
{"level":"info","ts":1728853115.0210574,"msg":"autosaved config (load with --resume flag)","file":"/config/caddy/autosave.json"}
{"level":"info","ts":1728853115.0210874,"msg":"serving initial configuration"}
{"level":"info","ts":1728853115.024382,"logger":"tls","msg":"storage cleaning happened too recently; skipping for now","storage":"FileStorage:/data/caddy","instance":"909323ff-c7fe-438d-bdba-427a3e9cea1b","try_again":1728939515.0243807,"try_again_in":86399.999999683}
{"level":"info","ts":1728853115.0244448,"logger":"tls","msg":"finished cleaning storage units"}