1. The problem I’m having:
Caddy reverse proxy works fine for services running on localhost, however, it is failing to forward connection to service running on another host.
2. Error messages and/or full log output:
{"level":"error","ts":1682112395.053308,"logger":"http.log.error","msg":"read tcp 192.168.0.183:57463->192.168.0.1:3001: read: connection reset by peer","request":{"remote_ip":"172.70.207.54","remote_port":"22698","proto":"HTTP/2.0","method":"GET","host":"ntop.greghao.com","uri":"/favicon.ico","headers":{"X-Forwarded-For":["99.150.202.198"],"Sec-Ch-Ua-Platform":["\"macOS\""],"Sec-Fetch-Dest":["image"],"Referer":["https://ntop.greghao.com/"],"Cf-Ray":["7bb8b4c50be308b2-LAX"],"Cf-Visitor":["{\"scheme\":\"https\"}"],"Sec-Ch-Ua-Mobile":["?0"],"Sec-Fetch-Site":["same-origin"],"Sec-Fetch-Mode":["no-cors"],"Cookie":[],"Cf-Connecting-Ip":["99.150.202.198"],"Cdn-Loop":["cloudflare"],"Sec-Ch-Ua":["\"Chromium\";v=\"112\", \"Google Chrome\";v=\"112\", \"Not:A-Brand\";v=\"99\""],"Dnt":["1"],"Accept":["image/avif,image/webp,image/apng,image/svg+xml,image/*,*/*;q=0.8"],"Accept-Language":["en-US,en;q=0.9,zh-TW;q=0.8,zh;q=0.7"],"Cf-Ipcountry":["US"],"Accept-Encoding":["gzip"],"X-Forwarded-Proto":["https"],"User-Agent":["Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/112.0.0.0 Safari/537.36"]},"tls":{"resumed":false,"version":772,"cipher_suite":4865,"proto":"h2","server_name":"ntop.greghao.com"}},"duration":0.004290625,"status":502,"err_id":"hyfsz6xjh","err_trace":"reverseproxy.statusError (reverseproxy.go:1299)"}
3. Caddy version:
❯ caddy version
v2.6.4 h1:2hwYqiRwk1tf3VruhMpLcYTg+11fCdr8S3jhNAdnPy8=
4. How I installed and ran Caddy:
a. System environment:
MacOS Ventura 13.3.1
b. Command:
brew services caddy start
d. My complete Caddy config:
❯ caddy fmt
{
email ---
}
(basic-auth) {
basicauth / {
--- ---
}
}
sabnzbd.greghao.com {
reverse_proxy http://127.0.0.1:8080
}
portainer.greghao.com {
reverse_proxy http://127.0.0.1:9090
}
trans.greghao.com {
reverse_proxy http://127.0.0.1:9091
}
radarr.greghao.com {
import basic-auth
reverse_proxy http://127.0.0.1:9092
}
sonarr.greghao.com {
import basic-auth
reverse_proxy http://127.0.0.1:9093
}
tautulli.greghao.com {
reverse_proxy http://127.0.0.1:9094
}
www.greghao.com {
import basic-auth
reverse_proxy http://127.0.0.1:9095
}
jackett.greghao.com {
import basic-auth
reverse_proxy http://127.0.0.1:9096
}
overseerr.greghao.com {
reverse_proxy http://127.0.0.1:9097
}
ntop.greghao.com {
import basic-auth
reverse_proxy * http://192.168.0.1:3001
}