1. The problem I’m having:
Adding a second domain to an already working caddy setup, to point to a wordpress install won’t work.
For some reason the url reroutes to the same url while adding the port. i.e. example.com becomes example.com:8080 in the header.
I have spent hours troubleshooting this and going every possible thing that could be wrong. I’ve rerolled all the tokens, checked the zones, checked the port forwarding, caddyfiles, api tokens, env var, wordpress site url, https settings on the domain, dns records…
2. Error messages and/or full log output:
ERR_CONNECTION_TIMED_OUT
3. Caddy version:
v2.9.0 h1:rteY8N18LsQn+2KVk6R10Vg/AlNsID1N/Ek9JLjm2yE=
4. How I installed and ran Caddy:
Installed on ubuntu, run as systemd on start up to serve traffic from outside the network to two machines via two URLs.
a. System environment:
systemd on Ubuntu 22.04 on amd64. Website backend is in docker for one of the URLs (i.e. wordpress stack) while the other url is all hosted on ubuntu, including caddy. These are hosted on a different machine on the same network than the one the docker instance is running on.
b. Command:
systemctl restart caddy
systemctl daemon-reload
d. My complete Caddy config:
mitchflix.net {
reverse_proxy IP_ADDRESS:8096
tls {
issuer acme {
dns cloudflare {env.TOKEN_1}
resolvers 1.1.1.1
propagation_delay 60s
propagation_timeout -1
}
}
}
rhysnroll.net {
reverse_proxy http://IP_ADDRESS:6789/
tls {
issuer acme {
dns cloudflare {env.TOKEN_2}
resolvers 1.1.1.1
propagation_delay 60s
propagation_timeout -1
}
}
}
5. Links to relevant resources:
You may noticed I have changed the second URL to include http:// - I’ve been troubleshooting and trying out everything possible to get this to work. One of the suggestions was to change the url back to http to see if there was something dodgy going on with SSL but it didn’t work with or without it.