I currently have Caddy working as a reverse proxy for my Emby server along with Cloudfare DNS API verification. I am trying to add another proxy to it for Sonarr. When I add the additional config commands it is not working properly for the sonarr site. Emby still works fine.
After a decent amount of debugging I ended up fixing it by deleting the Windows service and recreating it. I don’t understand why this was required, but running the command at the CLI seemed to work okay so I just tried deleting and recreating the service and this made it work for the other domains I added.
yeah, if recreating the windows service fixed it, I’d look at that before touching the caddyfile much.
when caddy works from an interactive shell but not as a service, it’s usually one of the boring bits: service points at a different caddy.exe, loads a different Caddyfile, or doesn’t get the same env vars the shell had. the Cloudflare token is an easy one to miss there.
I’d run caddy validate --config <path-to-the-service-caddyfile> against the exact file the windows service uses, then compare that path/binary/env with whatever you tested manually.
the separate subdomain blocks look fine for this use case. I’d mostly be suspicious of stale service config or a service restart that didn’t really pick up the change.