1. The problem I’m having:
This is my first project that uses caddy.
I’m trying to achieve one of these two behaviors, using two different Caddyfiles
First behavior:
https://xxx.ddns.netshould be resolved ashttps://xxx.ddns.net:8080https://xxx.ddns.net:1234should be resolved ashttps://xxx.ddns.net:5678
The first one works, the second one doesn’t, it reports errorSSL_ERROR_RX_RECORD_TOO_LONG
Second behavior:
https://xxx.ddns.netshould be resolved ashttps://xxx.ddns.net:8080https://xxx.ddns.net/helloshould be resolved ashttps://xxx.ddns.net:1234
The first one works, the second one doesn’t, it reports error404
2. Error messages and/or full log output:
In the case of the first behavior, https://xxx.ddns.net:1234 leads to a browser page with error SSL_ERROR_RX_RECORD_TOO_LONG
In the case of the second behavior, https://xxx.ddns.net/hello/ leads to a browser page with a 404 error or a JSON file containing only “not found”
3. Caddy version:
I downloaded the windows amd64 binary without plugin available here https://caddyserver.com/download on 18/02/2026
4. How I installed and ran Caddy:
a. System environment:
Windows 11
b. Command:
Running caddy with bat file:
cd J:\Caddy
caddy run
d. My complete Caddy config:
First behavior:
{
email me@outlook.com
}
xxx.ddns.net:1234 {
reverse_proxy localhost:5678
}
xxx.ddns.net {
reverse_proxy localhost:8080
}
Second behavior (I tried replacing the first one, closing and opening caddy again):
{
email me@outlook.com
}
xxx.ddns.net {
handle /hello/* {
reverse_proxy localhost:1234
}
handle /* {
reverse_proxy localhost:8080
}
}
For the second behavior I also tried:
{
email me@outlook.com
}
xxx.ddns.net {
reverse_proxy /hello/* localhost:1234
reverse_proxy localhost:8080
}
5. Links to relevant resources:
https://caddyserver.com/docs/caddyfile/patterns#reverse-proxy
https://dev.to/vizalo/path-based-reverse-proxying-with-caddy-3gjm