Infinite redirect to sonarr/radarr

1. The problem I’m having:

I’m trying to run caddy as a reverse proxy in front of my sonarr and radarr instances, but requests fail with too many redirects.

It’s a very vanilla configuration, currently proxying HTTP to HTTP on the same subnet (they’re in fact all three in separate jails on the same server).

I’ve tried adding/removing all kind of additional headers, and nothing seems to make a difference.

Edit: I should also add that I see the same behavior when the sonarr server is running on a different server instead of a jail on the same server.

2. Error messages and/or full log output:

{"level":"debug","ts":1747841302.3570187,"logger":"http.handlers.rewrite","msg":"rewrote request","request":{"remote_ip":"10.0.1.48","remote_port":"63602","client_ip":"10.0.1.48","proto":"HTTP/1.1","method":"GET","host":"10.0.1.195","uri":"/","headers":{"Accept-Language":["en-US,en;q=0.9"],"Priority":["u=0, i"],"Accept-Encoding":["gzip, deflate"],"Connection":["keep-alive"],"User-Agent":["Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/18.5 Safari/605.1.15"],"Upgrade-Insecure-Requests":["1"],"Accept":["text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"]}},"method":"GET","uri":"/"}
{"level":"debug","ts":1747841302.357119,"logger":"http.handlers.reverse_proxy","msg":"selected upstream","dial":"10.0.1.118:7878","total_upstreams":1}
{"level":"debug","ts":1747841302.358811,"logger":"http.handlers.reverse_proxy","msg":"upstream roundtrip","upstream":"10.0.1.118:7878","duration":0.001646929,"request":{"remote_ip":"10.0.1.48","remote_port":"63602","client_ip":"10.0.1.48","proto":"HTTP/1.1","method":"GET","host":"10.0.1.118:7878","uri":"/","headers":{"X-Forwarded-Host":["10.0.1.195"],"User-Agent":["Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/18.5 Safari/605.1.15"],"Accept-Language":["en-US,en;q=0.9"],"X-Forwarded-Proto":["http"],"Accept":["text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"],"Accept-Encoding":["gzip, deflate"],"X-Forwarded-For":["10.0.1.48"],"Upgrade-Insecure-Requests":["1"],"Priority":["u=0, i"]}},"headers":{"Date":["Wed, 21 May 2025 15:28:21 GMT"],"Server":["Kestrel"],"Location":["/radarr/"],"Content-Length":["0"]},"status":302}
{"level":"debug","ts":1747841302.3728998,"logger":"http.handlers.rewrite","msg":"rewrote request","request":{"remote_ip":"10.0.1.48","remote_port":"63602","client_ip":"10.0.1.48","proto":"HTTP/1.1","method":"GET","host":"10.0.1.195","uri":"/","headers":{"Upgrade-Insecure-Requests":["1"],"Accept":["text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"],"Accept-Language":["en-US,en;q=0.9"],"Priority":["u=0, i"],"Accept-Encoding":["gzip, deflate"],"Connection":["keep-alive"],"User-Agent":["Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/18.5 Safari/605.1.15"]}},"method":"GET","uri":"/"}
{"level":"debug","ts":1747841302.3729467,"logger":"http.handlers.reverse_proxy","msg":"selected upstream","dial":"10.0.1.118:7878","total_upstreams":1}
{"level":"debug","ts":1747841302.373554,"logger":"http.handlers.reverse_proxy","msg":"upstream roundtrip","upstream":"10.0.1.118:7878","duration":0.000571551,"request":{"remote_ip":"10.0.1.48","remote_port":"63602","client_ip":"10.0.1.48","proto":"HTTP/1.1","method":"GET","host":"10.0.1.118:7878","uri":"/","headers":{"User-Agent":["Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/18.5 Safari/605.1.15"],"Priority":["u=0, i"],"Accept-Encoding":["gzip, deflate"],"X-Forwarded-For":["10.0.1.48"],"X-Forwarded-Proto":["http"],"Accept-Language":["en-US,en;q=0.9"],"X-Forwarded-Host":["10.0.1.195"],"Upgrade-Insecure-Requests":["1"],"Accept":["text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"]}},"headers":{"Content-Length":["0"],"Date":["Wed, 21 May 2025 15:28:21 GMT"],"Server":["Kestrel"],"Location":["/radarr/"]},"status":302}
{"level":"debug","ts":1747841302.3782508,"logger":"http.handlers.rewrite","msg":"rewrote request","request":{"remote_ip":"10.0.1.48","remote_port":"63602","client_ip":"10.0.1.48","proto":"HTTP/1.1","method":"GET","host":"10.0.1.195","uri":"/","headers":{"Accept":["text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"],"Accept-Language":["en-US,en;q=0.9"],"Priority":["u=0, i"],"Accept-Encoding":["gzip, deflate"],"Connection":["keep-alive"],"User-Agent":["Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/18.5 Safari/605.1.15"],"Upgrade-Insecure-Requests":["1"]}},"method":"GET","uri":"/"}
{"level":"debug","ts":1747841302.3782854,"logger":"http.handlers.reverse_proxy","msg":"selected upstream","dial":"10.0.1.118:7878","total_upstreams":1}
{"level":"debug","ts":1747841302.3790376,"logger":"http.handlers.reverse_proxy","msg":"upstream roundtrip","upstream":"10.0.1.118:7878","duration":0.000695425,"request":{"remote_ip":"10.0.1.48","remote_port":"63602","client_ip":"10.0.1.48","proto":"HTTP/1.1","method":"GET","host":"10.0.1.118:7878","uri":"/","headers":{"Accept":["text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"],"Accept-Language":["en-US,en;q=0.9"],"X-Forwarded-For":["10.0.1.48"],"Priority":["u=0, i"],"Accept-Encoding":["gzip, deflate"],"Upgrade-Insecure-Requests":["1"],"X-Forwarded-Proto":["http"],"X-Forwarded-Host":["10.0.1.195"],"User-Agent":["Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/18.5 Safari/605.1.15"]}},"headers":{"Content-Length":["0"],"Date":["Wed, 21 May 2025 15:28:21 GMT"],"Server":["Kestrel"],"Location":["/radarr/"]},"status":302}
{"level":"debug","ts":1747841302.3835835,"logger":"http.handlers.rewrite","msg":"rewrote request","request":{"remote_ip":"10.0.1.48","remote_port":"63602","client_ip":"10.0.1.48","proto":"HTTP/1.1","method":"GET","host":"10.0.1.195","uri":"/","headers":{"Accept-Encoding":["gzip, deflate"],"Connection":["keep-alive"],"User-Agent":["Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/18.5 Safari/605.1.15"],"Upgrade-Insecure-Requests":["1"],"Accept":["text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"],"Accept-Language":["en-US,en;q=0.9"],"Priority":["u=0, i"]}},"method":"GET","uri":"/"}
{"level":"debug","ts":1747841302.3836186,"logger":"http.handlers.reverse_proxy","msg":"selected upstream","dial":"10.0.1.118:7878","total_upstreams":1}
{"level":"debug","ts":1747841302.3841085,"logger":"http.handlers.reverse_proxy","msg":"upstream roundtrip","upstream":"10.0.1.118:7878","duration":0.000461097,"request":{"remote_ip":"10.0.1.48","remote_port":"63602","client_ip":"10.0.1.48","proto":"HTTP/1.1","method":"GET","host":"10.0.1.118:7878","uri":"/","headers":{"User-Agent":["Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/18.5 Safari/605.1.15"],"Accept-Language":["en-US,en;q=0.9"],"Accept-Encoding":["gzip, deflate"],"X-Forwarded-For":["10.0.1.48"],"X-Forwarded-Proto":["http"],"Priority":["u=0, i"],"Upgrade-Insecure-Requests":["1"],"X-Forwarded-Host":["10.0.1.195"],"Accept":["text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"]}},"headers":{"Location":["/radarr/"],"Content-Length":["0"],"Date":["Wed, 21 May 2025 15:28:21 GMT"],"Server":["Kestrel"]},"status":302}
{"level":"debug","ts":1747841302.3881466,"logger":"http.handlers.rewrite","msg":"rewrote request","request":{"remote_ip":"10.0.1.48","remote_port":"63602","client_ip":"10.0.1.48","proto":"HTTP/1.1","method":"GET","host":"10.0.1.195","uri":"/","headers":{"Connection":["keep-alive"],"User-Agent":["Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/18.5 Safari/605.1.15"],"Upgrade-Insecure-Requests":["1"],"Accept":["text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"],"Accept-Language":["en-US,en;q=0.9"],"Priority":["u=0, i"],"Accept-Encoding":["gzip, deflate"]}},"method":"GET","uri":"/"}
{"level":"debug","ts":1747841302.388181,"logger":"http.handlers.reverse_proxy","msg":"selected upstream","dial":"10.0.1.118:7878","total_upstreams":1}
{"level":"debug","ts":1747841302.3886912,"logger":"http.handlers.reverse_proxy","msg":"upstream roundtrip","upstream":"10.0.1.118:7878","duration":0.000480932,"request":{"remote_ip":"10.0.1.48","remote_port":"63602","client_ip":"10.0.1.48","proto":"HTTP/1.1","method":"GET","host":"10.0.1.118:7878","uri":"/","headers":{"Upgrade-Insecure-Requests":["1"],"X-Forwarded-Host":["10.0.1.195"],"Accept-Encoding":["gzip, deflate"],"User-Agent":["Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/18.5 Safari/605.1.15"],"Accept-Language":["en-US,en;q=0.9"],"X-Forwarded-For":["10.0.1.48"],"Priority":["u=0, i"],"X-Forwarded-Proto":["http"],"Accept":["text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"]}},"headers":{"Server":["Kestrel"],"Location":["/radarr/"],"Content-Length":["0"],"Date":["Wed, 21 May 2025 15:28:21 GMT"]},"status":302}
{"level":"debug","ts":1747841302.3922484,"logger":"http.handlers.rewrite","msg":"rewrote request","request":{"remote_ip":"10.0.1.48","remote_port":"63602","client_ip":"10.0.1.48","proto":"HTTP/1.1","method":"GET","host":"10.0.1.195","uri":"/","headers":{"Accept-Encoding":["gzip, deflate"],"Connection":["keep-alive"],"User-Agent":["Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/18.5 Safari/605.1.15"],"Upgrade-Insecure-Requests":["1"],"Accept":["text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"],"Accept-Language":["en-US,en;q=0.9"],"Priority":["u=0, i"]}},"method":"GET","uri":"/"}
{"level":"debug","ts":1747841302.3922799,"logger":"http.handlers.reverse_proxy","msg":"selected upstream","dial":"10.0.1.118:7878","total_upstreams":1}
{"level":"debug","ts":1747841302.3930578,"logger":"http.handlers.reverse_proxy","msg":"upstream roundtrip","upstream":"10.0.1.118:7878","duration":0.000748636,"request":{"remote_ip":"10.0.1.48","remote_port":"63602","client_ip":"10.0.1.48","proto":"HTTP/1.1","method":"GET","host":"10.0.1.118:7878","uri":"/","headers":{"X-Forwarded-For":["10.0.1.48"],"Accept":["text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"],"Accept-Language":["en-US,en;q=0.9"],"X-Forwarded-Host":["10.0.1.195"],"User-Agent":["Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/18.5 Safari/605.1.15"],"Upgrade-Insecure-Requests":["1"],"Priority":["u=0, i"],"Accept-Encoding":["gzip, deflate"],"X-Forwarded-Proto":["http"]}},"headers":{"Content-Length":["0"],"Date":["Wed, 21 May 2025 15:28:21 GMT"],"Server":["Kestrel"],"Location":["/radarr/"]},"status":302}
{"level":"debug","ts":1747841302.3968165,"logger":"http.handlers.rewrite","msg":"rewrote request","request":{"remote_ip":"10.0.1.48","remote_port":"63602","client_ip":"10.0.1.48","proto":"HTTP/1.1","method":"GET","host":"10.0.1.195","uri":"/","headers":{"Connection":["keep-alive"],"User-Agent":["Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/18.5 Safari/605.1.15"],"Upgrade-Insecure-Requests":["1"],"Accept":["text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"],"Accept-Language":["en-US,en;q=0.9"],"Priority":["u=0, i"],"Accept-Encoding":["gzip, deflate"]}},"method":"GET","uri":"/"}
{"level":"debug","ts":1747841302.3968494,"logger":"http.handlers.reverse_proxy","msg":"selected upstream","dial":"10.0.1.118:7878","total_upstreams":1}
{"level":"debug","ts":1747841302.3973186,"logger":"http.handlers.reverse_proxy","msg":"upstream roundtrip","upstream":"10.0.1.118:7878","duration":0.000440961,"request":{"remote_ip":"10.0.1.48","remote_port":"63602","client_ip":"10.0.1.48","proto":"HTTP/1.1","method":"GET","host":"10.0.1.118:7878","uri":"/","headers":{"Priority":["u=0, i"],"Accept-Encoding":["gzip, deflate"],"Accept":["text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"],"User-Agent":["Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/18.5 Safari/605.1.15"],"X-Forwarded-Host":["10.0.1.195"],"Upgrade-Insecure-Requests":["1"],"Accept-Language":["en-US,en;q=0.9"],"X-Forwarded-For":["10.0.1.48"],"X-Forwarded-Proto":["http"]}},"headers":{"Content-Length":["0"],"Date":["Wed, 21 May 2025 15:28:21 GMT"],"Server":["Kestrel"],"Location":["/radarr/"]},"status":302}
{"level":"debug","ts":1747841302.4013498,"logger":"http.handlers.rewrite","msg":"rewrote request","request":{"remote_ip":"10.0.1.48","remote_port":"63602","client_ip":"10.0.1.48","proto":"HTTP/1.1","method":"GET","host":"10.0.1.195","uri":"/","headers":{"User-Agent":["Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/18.5 Safari/605.1.15"],"Upgrade-Insecure-Requests":["1"],"Accept":["text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"],"Accept-Language":["en-US,en;q=0.9"],"Priority":["u=0, i"],"Accept-Encoding":["gzip, deflate"],"Connection":["keep-alive"]}},"method":"GET","uri":"/"}
{"level":"debug","ts":1747841302.4013836,"logger":"http.handlers.reverse_proxy","msg":"selected upstream","dial":"10.0.1.118:7878","total_upstreams":1}
{"level":"debug","ts":1747841302.4018416,"logger":"http.handlers.reverse_proxy","msg":"upstream roundtrip","upstream":"10.0.1.118:7878","duration":0.00042751,"request":{"remote_ip":"10.0.1.48","remote_port":"63602","client_ip":"10.0.1.48","proto":"HTTP/1.1","method":"GET","host":"10.0.1.118:7878","uri":"/","headers":{"User-Agent":["Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/18.5 Safari/605.1.15"],"X-Forwarded-Proto":["http"],"Accept-Language":["en-US,en;q=0.9"],"Priority":["u=0, i"],"X-Forwarded-For":["10.0.1.48"],"Accept-Encoding":["gzip, deflate"],"X-Forwarded-Host":["10.0.1.195"],"Upgrade-Insecure-Requests":["1"],"Accept":["text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"]}},"headers":{"Server":["Kestrel"],"Location":["/radarr/"],"Content-Length":["0"],"Date":["Wed, 21 May 2025 15:28:21 GMT"]},"status":302}
{"level":"debug","ts":1747841302.406616,"logger":"http.handlers.rewrite","msg":"rewrote request","request":{"remote_ip":"10.0.1.48","remote_port":"63602","client_ip":"10.0.1.48","proto":"HTTP/1.1","method":"GET","host":"10.0.1.195","uri":"/","headers":{"Accept-Language":["en-US,en;q=0.9"],"Priority":["u=0, i"],"Accept-Encoding":["gzip, deflate"],"Connection":["keep-alive"],"User-Agent":["Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/18.5 Safari/605.1.15"],"Upgrade-Insecure-Requests":["1"],"Accept":["text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"]}},"method":"GET","uri":"/"}
{"level":"debug","ts":1747841302.4066503,"logger":"http.handlers.reverse_proxy","msg":"selected upstream","dial":"10.0.1.118:7878","total_upstreams":1}
{"level":"debug","ts":1747841302.4071174,"logger":"http.handlers.reverse_proxy","msg":"upstream roundtrip","upstream":"10.0.1.118:7878","duration":0.000439472,"request":{"remote_ip":"10.0.1.48","remote_port":"63602","client_ip":"10.0.1.48","proto":"HTTP/1.1","method":"GET","host":"10.0.1.118:7878","uri":"/","headers":{"Priority":["u=0, i"],"User-Agent":["Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/18.5 Safari/605.1.15"],"Accept":["text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"],"X-Forwarded-Proto":["http"],"Upgrade-Insecure-Requests":["1"],"Accept-Language":["en-US,en;q=0.9"],"Accept-Encoding":["gzip, deflate"],"X-Forwarded-Host":["10.0.1.195"],"X-Forwarded-For":["10.0.1.48"]}},"headers":{"Content-Length":["0"],"Date":["Wed, 21 May 2025 15:28:21 GMT"],"Server":["Kestrel"],"Location":["/radarr/"]},"status":302}
{"level":"debug","ts":1747841302.4124665,"logger":"http.handlers.rewrite","msg":"rewrote request","request":{"remote_ip":"10.0.1.48","remote_port":"63602","client_ip":"10.0.1.48","proto":"HTTP/1.1","method":"GET","host":"10.0.1.195","uri":"/","headers":{"Accept-Language":["en-US,en;q=0.9"],"Priority":["u=0, i"],"Accept-Encoding":["gzip, deflate"],"Connection":["keep-alive"],"User-Agent":["Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/18.5 Safari/605.1.15"],"Upgrade-Insecure-Requests":["1"],"Accept":["text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"]}},"method":"GET","uri":"/"}
{"level":"debug","ts":1747841302.4125,"logger":"http.handlers.reverse_proxy","msg":"selected upstream","dial":"10.0.1.118:7878","total_upstreams":1}
{"level":"debug","ts":1747841302.4130476,"logger":"http.handlers.reverse_proxy","msg":"upstream roundtrip","upstream":"10.0.1.118:7878","duration":0.000519489,"request":{"remote_ip":"10.0.1.48","remote_port":"63602","client_ip":"10.0.1.48","proto":"HTTP/1.1","method":"GET","host":"10.0.1.118:7878","uri":"/","headers":{"Accept":["text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"],"Accept-Encoding":["gzip, deflate"],"User-Agent":["Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/18.5 Safari/605.1.15"],"Accept-Language":["en-US,en;q=0.9"],"X-Forwarded-Host":["10.0.1.195"],"Upgrade-Insecure-Requests":["1"],"Priority":["u=0, i"],"X-Forwarded-For":["10.0.1.48"],"X-Forwarded-Proto":["http"]}},"headers":{"Content-Length":["0"],"Date":["Wed, 21 May 2025 15:28:21 GMT"],"Server":["Kestrel"],"Location":["/radarr/"]},"status":302}
{"level":"debug","ts":1747841302.41632,"logger":"http.handlers.rewrite","msg":"rewrote request","request":{"remote_ip":"10.0.1.48","remote_port":"63602","client_ip":"10.0.1.48","proto":"HTTP/1.1","method":"GET","host":"10.0.1.195","uri":"/","headers":{"User-Agent":["Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/18.5 Safari/605.1.15"],"Upgrade-Insecure-Requests":["1"],"Accept":["text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"],"Accept-Language":["en-US,en;q=0.9"],"Priority":["u=0, i"],"Accept-Encoding":["gzip, deflate"],"Connection":["keep-alive"]}},"method":"GET","uri":"/"}
{"level":"debug","ts":1747841302.41635,"logger":"http.handlers.reverse_proxy","msg":"selected upstream","dial":"10.0.1.118:7878","total_upstreams":1}
{"level":"debug","ts":1747841302.4168103,"logger":"http.handlers.reverse_proxy","msg":"upstream roundtrip","upstream":"10.0.1.118:7878","duration":0.000434387,"request":{"remote_ip":"10.0.1.48","remote_port":"63602","client_ip":"10.0.1.48","proto":"HTTP/1.1","method":"GET","host":"10.0.1.118:7878","uri":"/","headers":{"Upgrade-Insecure-Requests":["1"],"Accept":["text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"],"Accept-Encoding":["gzip, deflate"],"X-Forwarded-Host":["10.0.1.195"],"Priority":["u=0, i"],"User-Agent":["Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/18.5 Safari/605.1.15"],"X-Forwarded-Proto":["http"],"Accept-Language":["en-US,en;q=0.9"],"X-Forwarded-For":["10.0.1.48"]}},"headers":{"Content-Length":["0"],"Date":["Wed, 21 May 2025 15:28:21 GMT"],"Server":["Kestrel"],"Location":["/radarr/"]},"status":302}
{"level":"debug","ts":1747841302.4199076,"logger":"http.handlers.rewrite","msg":"rewrote request","request":{"remote_ip":"10.0.1.48","remote_port":"63602","client_ip":"10.0.1.48","proto":"HTTP/1.1","method":"GET","host":"10.0.1.195","uri":"/","headers":{"User-Agent":["Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/18.5 Safari/605.1.15"],"Upgrade-Insecure-Requests":["1"],"Accept":["text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"],"Accept-Language":["en-US,en;q=0.9"],"Priority":["u=0, i"],"Accept-Encoding":["gzip, deflate"],"Connection":["keep-alive"]}},"method":"GET","uri":"/"}
{"level":"debug","ts":1747841302.4199393,"logger":"http.handlers.reverse_proxy","msg":"selected upstream","dial":"10.0.1.118:7878","total_upstreams":1}
{"level":"debug","ts":1747841302.420392,"logger":"http.handlers.reverse_proxy","msg":"upstream roundtrip","upstream":"10.0.1.118:7878","duration":0.000424622,"request":{"remote_ip":"10.0.1.48","remote_port":"63602","client_ip":"10.0.1.48","proto":"HTTP/1.1","method":"GET","host":"10.0.1.118:7878","uri":"/","headers":{"Priority":["u=0, i"],"X-Forwarded-For":["10.0.1.48"],"Upgrade-Insecure-Requests":["1"],"X-Forwarded-Host":["10.0.1.195"],"Accept":["text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"],"X-Forwarded-Proto":["http"],"User-Agent":["Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/18.5 Safari/605.1.15"],"Accept-Language":["en-US,en;q=0.9"],"Accept-Encoding":["gzip, deflate"]}},"headers":{"Content-Length":["0"],"Date":["Wed, 21 May 2025 15:28:21 GMT"],"Server":["Kestrel"],"Location":["/radarr/"]},"status":302}
{"level":"debug","ts":1747841302.4262183,"logger":"http.handlers.rewrite","msg":"rewrote request","request":{"remote_ip":"10.0.1.48","remote_port":"63602","client_ip":"10.0.1.48","proto":"HTTP/1.1","method":"GET","host":"10.0.1.195","uri":"/","headers":{"Accept-Language":["en-US,en;q=0.9"],"Priority":["u=0, i"],"Accept-Encoding":["gzip, deflate"],"Connection":["keep-alive"],"User-Agent":["Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/18.5 Safari/605.1.15"],"Upgrade-Insecure-Requests":["1"],"Accept":["text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"]}},"method":"GET","uri":"/"}
{"level":"debug","ts":1747841302.426249,"logger":"http.handlers.reverse_proxy","msg":"selected upstream","dial":"10.0.1.118:7878","total_upstreams":1}
{"level":"debug","ts":1747841302.4266524,"logger":"http.handlers.reverse_proxy","msg":"upstream roundtrip","upstream":"10.0.1.118:7878","duration":0.00037817,"request":{"remote_ip":"10.0.1.48","remote_port":"63602","client_ip":"10.0.1.48","proto":"HTTP/1.1","method":"GET","host":"10.0.1.118:7878","uri":"/","headers":{"Priority":["u=0, i"],"Accept":["text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"],"X-Forwarded-Proto":["http"],"X-Forwarded-Host":["10.0.1.195"],"X-Forwarded-For":["10.0.1.48"],"User-Agent":["Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/18.5 Safari/605.1.15"],"Accept-Language":["en-US,en;q=0.9"],"Accept-Encoding":["gzip, deflate"],"Upgrade-Insecure-Requests":["1"]}},"headers":{"Content-Length":["0"],"Date":["Wed, 21 May 2025 15:28:22 GMT"],"Server":["Kestrel"],"Location":["/radarr/"]},"status":302}
{"level":"debug","ts":1747841302.4392037,"logger":"http.handlers.rewrite","msg":"rewrote request","request":{"remote_ip":"10.0.1.48","remote_port":"63602","client_ip":"10.0.1.48","proto":"HTTP/1.1","method":"GET","host":"10.0.1.195","uri":"/","headers":{"Priority":["u=0, i"],"Accept-Encoding":["gzip, deflate"],"Connection":["keep-alive"],"User-Agent":["Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/18.5 Safari/605.1.15"],"Upgrade-Insecure-Requests":["1"],"Accept":["text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"],"Accept-Language":["en-US,en;q=0.9"]}},"method":"GET","uri":"/"}
{"level":"debug","ts":1747841302.4392407,"logger":"http.handlers.reverse_proxy","msg":"selected upstream","dial":"10.0.1.118:7878","total_upstreams":1}
{"level":"debug","ts":1747841302.4397886,"logger":"http.handlers.reverse_proxy","msg":"upstream roundtrip","upstream":"10.0.1.118:7878","duration":0.000508479,"request":{"remote_ip":"10.0.1.48","remote_port":"63602","client_ip":"10.0.1.48","proto":"HTTP/1.1","method":"GET","host":"10.0.1.118:7878","uri":"/","headers":{"Upgrade-Insecure-Requests":["1"],"X-Forwarded-For":["10.0.1.48"],"Accept":["text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"],"Accept-Language":["en-US,en;q=0.9"],"Priority":["u=0, i"],"X-Forwarded-Host":["10.0.1.195"],"User-Agent":["Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/18.5 Safari/605.1.15"],"Accept-Encoding":["gzip, deflate"],"X-Forwarded-Proto":["http"]}},"headers":{"Server":["Kestrel"],"Location":["/radarr/"],"Content-Length":["0"],"Date":["Wed, 21 May 2025 15:28:22 GMT"]},"status":302}
{"level":"debug","ts":1747841302.4456525,"logger":"http.handlers.rewrite","msg":"rewrote request","request":{"remote_ip":"10.0.1.48","remote_port":"63602","client_ip":"10.0.1.48","proto":"HTTP/1.1","method":"GET","host":"10.0.1.195","uri":"/","headers":{"Accept-Language":["en-US,en;q=0.9"],"Priority":["u=0, i"],"Accept-Encoding":["gzip, deflate"],"Connection":["keep-alive"],"User-Agent":["Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/18.5 Safari/605.1.15"],"Upgrade-Insecure-Requests":["1"],"Accept":["text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"]}},"method":"GET","uri":"/"}
{"level":"debug","ts":1747841302.445692,"logger":"http.handlers.reverse_proxy","msg":"selected upstream","dial":"10.0.1.118:7878","total_upstreams":1}
{"level":"debug","ts":1747841302.4461567,"logger":"http.handlers.reverse_proxy","msg":"upstream roundtrip","upstream":"10.0.1.118:7878","duration":0.000433708,"request":{"remote_ip":"10.0.1.48","remote_port":"63602","client_ip":"10.0.1.48","proto":"HTTP/1.1","method":"GET","host":"10.0.1.118:7878","uri":"/","headers":{"X-Forwarded-For":["10.0.1.48"],"X-Forwarded-Host":["10.0.1.195"],"Accept-Language":["en-US,en;q=0.9"],"Upgrade-Insecure-Requests":["1"],"Accept":["text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"],"Accept-Encoding":["gzip, deflate"],"X-Forwarded-Proto":["http"],"User-Agent":["Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/18.5 Safari/605.1.15"],"Priority":["u=0, i"]}},"headers":{"Content-Length":["0"],"Date":["Wed, 21 May 2025 15:28:22 GMT"],"Server":["Kestrel"],"Location":["/radarr/"]},"status":302}
{"level":"debug","ts":1747841302.4526455,"logger":"http.handlers.rewrite","msg":"rewrote request","request":{"remote_ip":"10.0.1.48","remote_port":"63602","client_ip":"10.0.1.48","proto":"HTTP/1.1","method":"GET","host":"10.0.1.195","uri":"/","headers":{"Connection":["keep-alive"],"User-Agent":["Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/18.5 Safari/605.1.15"],"Upgrade-Insecure-Requests":["1"],"Accept":["text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"],"Accept-Language":["en-US,en;q=0.9"],"Priority":["u=0, i"],"Accept-Encoding":["gzip, deflate"]}},"method":"GET","uri":"/"}
{"level":"debug","ts":1747841302.452678,"logger":"http.handlers.reverse_proxy","msg":"selected upstream","dial":"10.0.1.118:7878","total_upstreams":1}
{"level":"debug","ts":1747841302.4531553,"logger":"http.handlers.reverse_proxy","msg":"upstream roundtrip","upstream":"10.0.1.118:7878","duration":0.000439356,"request":{"remote_ip":"10.0.1.48","remote_port":"63602","client_ip":"10.0.1.48","proto":"HTTP/1.1","method":"GET","host":"10.0.1.118:7878","uri":"/","headers":{"Accept":["text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"],"X-Forwarded-For":["10.0.1.48"],"Accept-Encoding":["gzip, deflate"],"Upgrade-Insecure-Requests":["1"],"X-Forwarded-Host":["10.0.1.195"],"Priority":["u=0, i"],"X-Forwarded-Proto":["http"],"Accept-Language":["en-US,en;q=0.9"],"User-Agent":["Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/18.5 Safari/605.1.15"]}},"headers":{"Date":["Wed, 21 May 2025 15:28:22 GMT"],"Server":["Kestrel"],"Location":["/radarr/"],"Content-Length":["0"]},"status":302}
{"level":"debug","ts":1747841302.4564848,"logger":"http.handlers.rewrite","msg":"rewrote request","request":{"remote_ip":"10.0.1.48","remote_port":"63602","client_ip":"10.0.1.48","proto":"HTTP/1.1","method":"GET","host":"10.0.1.195","uri":"/","headers":{"User-Agent":["Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/18.5 Safari/605.1.15"],"Upgrade-Insecure-Requests":["1"],"Accept":["text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"],"Accept-Language":["en-US,en;q=0.9"],"Priority":["u=0, i"],"Accept-Encoding":["gzip, deflate"],"Connection":["keep-alive"]}},"method":"GET","uri":"/"}
{"level":"debug","ts":1747841302.456523,"logger":"http.handlers.reverse_proxy","msg":"selected upstream","dial":"10.0.1.118:7878","total_upstreams":1}
{"level":"debug","ts":1747841302.4569676,"logger":"http.handlers.reverse_proxy","msg":"upstream roundtrip","upstream":"10.0.1.118:7878","duration":0.00041102,"request":{"remote_ip":"10.0.1.48","remote_port":"63602","client_ip":"10.0.1.48","proto":"HTTP/1.1","method":"GET","host":"10.0.1.118:7878","uri":"/","headers":{"Upgrade-Insecure-Requests":["1"],"X-Forwarded-Host":["10.0.1.195"],"X-Forwarded-For":["10.0.1.48"],"Accept":["text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"],"Accept-Encoding":["gzip, deflate"],"User-Agent":["Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/18.5 Safari/605.1.15"],"Accept-Language":["en-US,en;q=0.9"],"X-Forwarded-Proto":["http"],"Priority":["u=0, i"]}},"headers":{"Server":["Kestrel"],"Location":["/radarr/"],"Content-Length":["0"],"Date":["Wed, 21 May 2025 15:28:22 GMT"]},"status":302}
{"level":"debug","ts":1747841302.4601707,"logger":"http.handlers.rewrite","msg":"rewrote request","request":{"remote_ip":"10.0.1.48","remote_port":"63602","client_ip":"10.0.1.48","proto":"HTTP/1.1","method":"GET","host":"10.0.1.195","uri":"/","headers":{"Accept-Language":["en-US,en;q=0.9"],"Priority":["u=0, i"],"Accept-Encoding":["gzip, deflate"],"Connection":["keep-alive"],"User-Agent":["Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/18.5 Safari/605.1.15"],"Upgrade-Insecure-Requests":["1"],"Accept":["text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"]}},"method":"GET","uri":"/"}
{"level":"debug","ts":1747841302.4602022,"logger":"http.handlers.reverse_proxy","msg":"selected upstream","dial":"10.0.1.118:7878","total_upstreams":1}
{"level":"debug","ts":1747841302.4606438,"logger":"http.handlers.reverse_proxy","msg":"upstream roundtrip","upstream":"10.0.1.118:7878","duration":0.000413033,"request":{"remote_ip":"10.0.1.48","remote_port":"63602","client_ip":"10.0.1.48","proto":"HTTP/1.1","method":"GET","host":"10.0.1.118:7878","uri":"/","headers":{"Priority":["u=0, i"],"X-Forwarded-Host":["10.0.1.195"],"Accept-Language":["en-US,en;q=0.9"],"Upgrade-Insecure-Requests":["1"],"Accept":["text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"],"Accept-Encoding":["gzip, deflate"],"X-Forwarded-For":["10.0.1.48"],"User-Agent":["Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/18.5 Safari/605.1.15"],"X-Forwarded-Proto":["http"]}},"headers":{"Content-Length":["0"],"Date":["Wed, 21 May 2025 15:28:22 GMT"],"Server":["Kestrel"],"Location":["/radarr/"]},"status":302}
{"level":"debug","ts":1747841302.4636626,"logger":"http.handlers.rewrite","msg":"rewrote request","request":{"remote_ip":"10.0.1.48","remote_port":"63602","client_ip":"10.0.1.48","proto":"HTTP/1.1","method":"GET","host":"10.0.1.195","uri":"/","headers":{"User-Agent":["Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/18.5 Safari/605.1.15"],"Upgrade-Insecure-Requests":["1"],"Accept":["text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"],"Accept-Language":["en-US,en;q=0.9"],"Priority":["u=0, i"],"Accept-Encoding":["gzip, deflate"],"Connection":["keep-alive"]}},"method":"GET","uri":"/"}
{"level":"debug","ts":1747841302.463693,"logger":"http.handlers.reverse_proxy","msg":"selected upstream","dial":"10.0.1.118:7878","total_upstreams":1}
{"level":"debug","ts":1747841302.4641252,"logger":"http.handlers.reverse_proxy","msg":"upstream roundtrip","upstream":"10.0.1.118:7878","duration":0.000396442,"request":{"remote_ip":"10.0.1.48","remote_port":"63602","client_ip":"10.0.1.48","proto":"HTTP/1.1","method":"GET","host":"10.0.1.118:7878","uri":"/","headers":{"Priority":["u=0, i"],"X-Forwarded-Proto":["http"],"X-Forwarded-Host":["10.0.1.195"],"Upgrade-Insecure-Requests":["1"],"User-Agent":["Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/18.5 Safari/605.1.15"],"Accept-Language":["en-US,en;q=0.9"],"Accept-Encoding":["gzip, deflate"],"X-Forwarded-For":["10.0.1.48"],"Accept":["text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"]}},"headers":{"Content-Length":["0"],"Date":["Wed, 21 May 2025 15:28:22 GMT"],"Server":["Kestrel"],"Location":["/radarr/"]},"status":302}
{"level":"debug","ts":1747841302.4670854,"logger":"http.handlers.rewrite","msg":"rewrote request","request":{"remote_ip":"10.0.1.48","remote_port":"63602","client_ip":"10.0.1.48","proto":"HTTP/1.1","method":"GET","host":"10.0.1.195","uri":"/","headers":{"Accept-Encoding":["gzip, deflate"],"Connection":["keep-alive"],"User-Agent":["Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/18.5 Safari/605.1.15"],"Upgrade-Insecure-Requests":["1"],"Accept":["text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"],"Accept-Language":["en-US,en;q=0.9"],"Priority":["u=0, i"]}},"method":"GET","uri":"/"}
{"level":"debug","ts":1747841302.4671173,"logger":"http.handlers.reverse_proxy","msg":"selected upstream","dial":"10.0.1.118:7878","total_upstreams":1}
{"level":"debug","ts":1747841302.4675372,"logger":"http.handlers.reverse_proxy","msg":"upstream roundtrip","upstream":"10.0.1.118:7878","duration":0.00039266,"request":{"remote_ip":"10.0.1.48","remote_port":"63602","client_ip":"10.0.1.48","proto":"HTTP/1.1","method":"GET","host":"10.0.1.118:7878","uri":"/","headers":{"Accept-Language":["en-US,en;q=0.9"],"Accept":["text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"],"Upgrade-Insecure-Requests":["1"],"X-Forwarded-Host":["10.0.1.195"],"X-Forwarded-For":["10.0.1.48"],"Accept-Encoding":["gzip, deflate"],"Priority":["u=0, i"],"X-Forwarded-Proto":["http"],"User-Agent":["Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/18.5 Safari/605.1.15"]}},"headers":{"Content-Length":["0"],"Date":["Wed, 21 May 2025 15:28:22 GMT"],"Server":["Kestrel"],"Location":["/radarr/"]},"status":302}
{"level":"debug","ts":1747841302.4705765,"logger":"http.handlers.rewrite","msg":"rewrote request","request":{"remote_ip":"10.0.1.48","remote_port":"63602","client_ip":"10.0.1.48","proto":"HTTP/1.1","method":"GET","host":"10.0.1.195","uri":"/","headers":{"User-Agent":["Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/18.5 Safari/605.1.15"],"Upgrade-Insecure-Requests":["1"],"Accept":["text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"],"Accept-Language":["en-US,en;q=0.9"],"Priority":["u=0, i"],"Accept-Encoding":["gzip, deflate"],"Connection":["keep-alive"]}},"method":"GET","uri":"/"}
{"level":"debug","ts":1747841302.470609,"logger":"http.handlers.reverse_proxy","msg":"selected upstream","dial":"10.0.1.118:7878","total_upstreams":1}
{"level":"debug","ts":1747841302.4710493,"logger":"http.handlers.reverse_proxy","msg":"upstream roundtrip","upstream":"10.0.1.118:7878","duration":0.000393549,"request":{"remote_ip":"10.0.1.48","remote_port":"63602","client_ip":"10.0.1.48","proto":"HTTP/1.1","method":"GET","host":"10.0.1.118:7878","uri":"/","headers":{"Accept":["text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"],"Accept-Encoding":["gzip, deflate"],"Upgrade-Insecure-Requests":["1"],"X-Forwarded-Proto":["http"],"Priority":["u=0, i"],"User-Agent":["Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/18.5 Safari/605.1.15"],"Accept-Language":["en-US,en;q=0.9"],"X-Forwarded-Host":["10.0.1.195"],"X-Forwarded-For":["10.0.1.48"]}},"headers":{"Content-Length":["0"],"Date":["Wed, 21 May 2025 15:28:22 GMT"],"Server":["Kestrel"],"Location":["/radarr/"]},"status":302}

3. Caddy version:

v2.9.1

4. How I installed and ran Caddy:

a. System environment:

FreeBSD 13.3-RELEASE-p4 amd64 running in a jail on TrueNAS CORE 13.3.

b. Command:

pkg install caddy
service caddy enable
service caddy start

c. Service/unit/compose file:

Default /usr/local/etc/rc.d/caddy:

#!/bin/sh

# PROVIDE: caddy
# REQUIRE: LOGIN DAEMON NETWORKING
# KEYWORD: shutdown

# To enable caddy:
#
# - Edit /usr/local/etc/caddy/Caddyfile
#   See https://caddyserver.com/docs/
# - Run 'service caddy enable'
#
# Note while Caddy currently defaults to running as root:wheel, it is strongly
# recommended to run the server as an unprivileged user, such as www:www.
#
# - Use security/portacl-rc to enable privileged port binding:
#
#   # pkg install security/portacl-rc
#   # sysrc portacl_users+=www
#   # sysrc portacl_user_www_tcp="http https"
#   # sysrc portacl_user_www_udp="https"
#   # service portacl enable
#   # service portacl start
#
# - Configure caddy to run as www:www
#
#   # sysrc caddy_user=www caddy_group=www
#
# - Note if Caddy has been started as root previously, files in
#   /var/log/caddy, /var/db/caddy, and /var/run/caddy may require their ownership
#   changing manually.

# Optional settings:
# caddy_command (string):     Full path to the caddy binary
# caddy_config (string):      Full path to caddy config file
#                             (/usr/local/etc/caddy/Caddyfile)
# caddy_adapter (string):     Config adapter type (caddyfile)
# caddy_admin (string):       Default administration endpoint
#                             (unix//var/run/caddy/caddy.sock)
# caddy_directory (string):   Root for caddy storage (ACME certs, etc.)
#                             (/var/db/caddy)
# caddy_extra_flags (string): Extra flags passed to caddy start
# caddy_logdir (string):      Where caddy logs are stored
#                             (/var/log/caddy)
# caddy_logfile (string):     Location of process log (${caddy_logdir}/caddy.log)
#                             This is for startup/shutdown/error messages.
#                             To create an access log, see:
#                             https://caddyserver.com/docs/caddyfile/directives/log
# caddy_user (user):          User to run caddy (root)
# caddy_group (group):        Group to run caddy (wheel)
#
# This script will honor XDG_CONFIG_HOME/XDG_DATA_HOME. Caddy will create a
# .../caddy subdir in each of those. By default, they are subdirs of /var/db/caddy.
# See https://caddyserver.com/docs/conventions#data-directory

. /etc/rc.subr

name=caddy
rcvar=caddy_enable
desc="Powerful, enterprise-ready, open source web server with automatic HTTPS written in Go"

load_rc_config $name

# Defaults
: ${caddy_enable:=NO}
: ${caddy_adapter:=caddyfile}
: ${caddy_config:="/usr/local/etc/caddy/Caddyfile"}
: ${caddy_admin:="unix//var/run/${name}/${name}.sock"}
: ${caddy_command:="/usr/local/bin/${name}"}
: ${caddy_directory:=/var/db/caddy}
: ${caddy_extra_flags:=""}
: ${caddy_logdir:="/var/log/${name}"}
: ${caddy_logfile:="${caddy_logdir}/${name}.log"}
: ${caddy_user:="root"}
: ${caddy_group:="wheel"}

# Config and base directories
: ${XDG_CONFIG_HOME:="${caddy_directory}/config"}
: ${XDG_DATA_HOME:="${caddy_directory}/data"}
export XDG_CONFIG_HOME XDG_DATA_HOME

# Default admin interface
export CADDY_ADMIN="${caddy_admin}"

command="${caddy_command}"
pidfile="/var/run/${name}/${name}.pid"

required_files="${caddy_config} ${caddy_command}"

start_precmd="caddy_precmd"
start_cmd="caddy_start"
stop_precmd="caddy_prestop"

# JSON is the native format, so there is no "adapter" for it
if [ "${caddy_adapter}" = "json" ]; then
    caddy_flags="--config ${caddy_config}"
else
    caddy_flags="--config ${caddy_config} --adapter ${caddy_adapter}"
fi

# Extra Commands
extra_commands="configtest reload reloadssl"
configtest_cmd="caddy_execute validate ${caddy_flags}"
reload_cmd="caddy_execute reload ${caddy_flags}"
reloadssl_cmd="caddy_execute reload --force ${caddy_flags}"

caddy_execute()
{
    /usr/bin/su -m "${caddy_user}" -c "${caddy_command} $*"
}

caddy_precmd()
{
    # Create required directories and set permissions
    /usr/bin/install -d -m 755 -o "${caddy_user}" -g "${caddy_group}" ${caddy_directory}
    /usr/bin/install -d -m 700 -o "${caddy_user}" -g "${caddy_group}" ${caddy_directory}/config
    /usr/bin/install -d -m 700 -o "${caddy_user}" -g "${caddy_group}" ${caddy_directory}/data
    /usr/bin/install -d -m 755 -o "${caddy_user}" -g "${caddy_group}" ${caddy_logdir}
    /usr/bin/install -d -m 700 -o "${caddy_user}" -g "${caddy_group}" /var/run/caddy
    if [ -e ${caddy_logfile} ]; then
        /bin/chmod 644 ${caddy_logfile}
        /usr/sbin/chown "${caddy_user}:${caddy_group}" ${caddy_logfile}
    else
        /usr/bin/install -m 644 -o "${caddy_user}" -g "${caddy_group}" /dev/null ${caddy_logfile}
    fi
}

caddy_start()
{
    echo -n "Starting caddy... "
    /usr/bin/su -m ${caddy_user} -c "${caddy_command} start ${caddy_flags} \
        ${caddy_extra_flags} --pidfile ${pidfile}" >> ${caddy_logfile} 2>&1
    if [ $? -eq 0 ] && ps -ax -o pid | grep -q "$(cat ${pidfile})"; then
        echo "done"
        echo "Log: ${caddy_logfile}"
    else
        echo "Error: Caddy failed to start"
        echo "Check the caddy log: ${caddy_logfile}"
    fi
}

caddy_prestop()
{
    local result

    echo -n "Stopping caddy... "

    result="$(caddy_execute stop ${caddy_flags} 2>&1)"
    if [ ${?} -eq 0 ]; then
        echo "done"
        exit 0
    else
        if echo "${result}" | grep -q -e "connection refused" \
            -e "connect: no such file or directory"; then

            echo "admin interface unavailable; using pidfile"
            return 0
        else
            echo "Error: Unable to stop caddy"
            echo "Check the caddy log: ${caddy_logfile}"
            return 1
        fi
    fi
}

run_rc_command "$1"

d. My complete Caddy config:

# Unless the file starts with a global options block, the first
# uncommented line is always the address of your site.
#
{
        debug
}

http://10.0.1.195 {
        redir /radarr /radarr/
        handle_path /radarr/* {
                reverse_proxy http://10.0.1.118:7878
        }

        redir /sonarr /sonarr/
        handle_path /sonarr/* {
                reverse_proxy http://10.0.1.117:8989
        }

        log {
                output file /var/log/caddy/http-access.log
        }
}

5. Links to relevant resources:

I’ve already set both sonarr and radarr to use a base URL as per here.

The servers themselves work fine from their local addresses; the recommended Nginx configuration here works fine (when I run Nginx instead of Caddy, obviously).

This might be a pretty easy one. From the log:

  "headers": {
    "Content-Length": [
      "0"
    ],
    "Date": [
      "Wed, 21 May 2025 15:28:22 GMT"
    ],
    "Server": [
      "Kestrel"
    ],
    "Location": [
      "/radarr/"
    ]
  },
  "status": 302

Radarr is issuing this redirect to Caddy because Caddy is requesting "uri": "/".

This is because you’ve configured Caddy with handle_path /radarr/*.

handle_path can be useful when you’re trying to pin an upstream into a subfolder (if it’s single-page or otherwise location-aware and handles that gracefully). This is because it implicitly strips the prefix from the URI that Caddy is requesting upstream:

Works the same as the handle directive, but implicitly uses uri strip_prefix to strip the matched path prefix.
https://caddyserver.com/docs/caddyfile/directives/handle_path

i.e.: When you request /radarr/foobar to a handle_path /radarr/*, Caddy will send a request upstream for /foobar.

Since you’ve instructed Radarr (and Sonarr) that they are to use a URL base, you don’t need this implicit URI manipulation at all. You just need to redirect appropriately and then serve the reverse proxy as normal. So give it a try without handle_path:

        redir /radarr /radarr/
        reverse_proxy /radarr/* http://10.0.1.118:7878
2 Likes

Well wouldja look at that! It does work when you carefully read what the directives do! Thanks. :slight_smile: