Reverse Proxy multiple subdomains

1. Caddy version (caddy version):

Latest Windows

2. How I run Caddy:

a. System environment:

Windows Server 2022 base OS

b. Command:

caddy run (manual)
caddy start (NSSM points to a .bat file to run)

d. My complete Caddyfile or JSON config: {
    reverse_proxy localhost:8096
} {
    reverse_proxy localhost:8056

3. The problem I’m having:

When using multiple subdomains (which are hosted on Cloudflare and the DNS is setup correctly), only the first subdomain in Caddyfile works, and the error log complains that only one usage of each socket is normally permitted. This is when running caddy manually not as a service.

When running as a service, the service enters a paused state.

4. Error messages and/or full log output:

{"level":"info","ts":1654892743.021679,"msg":"using adjacent Caddyfile"}
{"level":"warn","ts":1654892743.0222063,"msg":"input is not formatted with 'caddy fmt'","adapter":"caddyfile","file":"Caddyfile","line":1}
run: loading initial config: loading new config: starting caddy administration endpoint: listen tcp bind: Only one usage of each socket address (protocol/network address/port) is normally permitted.
start: caddy process exited with error: exit status 1

5. What I already tried:

I’ve netstat’d and ensured nothing is running on port 2019, I’ve rebooted and also reinstalled the Caddy service, ensured no Caddy processes or services are running before starting it again.

6. Links to relevant resources:


Many thanks

Got it working. Seems nothing was inherently wrong, however I was building the Caddyfile in Notepad and running caddy fmt --overwrite Caddyfile fixed it.

This topic was automatically closed after 30 days. New replies are no longer allowed.