Issue with Docker Caddy and Castopod (podcast host)

1. The problem I’m having: Streaming of podcast episodes behind caddy is failing frequently.

I have a docker setup of the podcast host software (php) called castopod. In addition to hosting the actual mp3 files it has a web server setup that is used to manage the podcast. Caddy is used to provide the https certificate for the website.

Things seem to work well except when a listener actually downloads or streams an episode. Frequently (probably more than 50% of the time … but not ALL the time) it’s failing. After about five minutes the episode will loop back to the start. You can delete the episode from the player and retry it … and sometimes it works the second time (or the third time). I have tried three different podcast apps and all three exhibit the same behavior.

I get no error messages from the Castopod docker instance. I am getting numerous warnings and errors from Caddy.

The configuration file for Caddy is the one recommended by Castopod and it’s just a straightforward reverse proxy:

castopod.raisingconfidentteens.com {
    reverse_proxy rct-app:8000
}

2. Error messages and/or full log output:

here is an example from earlier tonight. I posted a new episode earlier. On one podcast app it played fine. On the second one, it played something like 5 minutes and then looped. When i started playing it I had the log file tailing and it dumped this (although it kept playing at that point):

{"level":"error","ts":1705047611.7066152,"logger":"http.handlers.reverse_proxy","msg":"aborting with incomplete response","upstream":"sp-app:8000","duration":0.000666283,"request":{"remote_ip":"173.16.126.4","remote_port":"54319","client_ip":"173.16.126.4","proto":"HTTP/2.0","method":"GET","host":"castopod.satoshis-plebs.com","uri":"/media/podcasts/sp/1705023367_8bcbf8ed279290dac112.mp3","headers":{"X-Playback-Session-Id":["061DC7B1-AD0C-42BA-BAD9-2031EC33FF3D"],"X-Forwarded-Proto":["https"],"Accept":["*/*"],"Cookie":[],"Accept-Language":["en-US,en;q=0.9"],"Accept-Encoding":["identity"],"X-Forwarded-For":["173.16.126.4"],"X-Forwarded-Host":["castopod.satoshis-plebs.com"],"Icy-Metadata":["1"],"User-Agent":["PodcastGuru 1.0.22 (build 91); iOS 17.1.2"]},"tls":{"resumed":false,"version":772,"cipher_suite":4865,"proto":"h2","server_name":"castopod.satoshis-plebs.com"}},"error":"writing: http2: stream closed"}

Like i said…it did continue playing for about 5 minutes …then it looped…when i reran the log tail it show a new entry - very similar though:


{"level":"error","ts":1705047684.6556194,"logger":"http.handlers.reverse_proxy","msg":"aborting with incomplete response","upstream":"sp-app:8000","duration":0.000617803,"request":{"remote_ip":"173.16.126.4","remote_port":"54319","client_ip":"173.16.126.4","proto":"HTTP/2.0","method":"GET","host":"castopod.satoshis-plebs.com","uri":"/media/podcasts/sp/1705023367_8bcbf8ed279290dac112.mp3","headers":{"Accept-Encoding":["identity"],"Accept":["*/*"],"Icy-Metadata":["1"],"X-Forwarded-Proto":["https"],"Accept-Language":["en-US,en;q=0.9"],"X-Playback-Session-Id":["061DC7B1-AD0C-42BA-BAD9-2031EC33FF3D"],"User-Agent":["PodcastGuru 1.0.22 (build 91); iOS 17.1.2"],"X-Forwarded-For":["173.16.126.4"],"X-Forwarded-Host":["castopod.satoshis-plebs.com"],"Cookie":[]},"tls":{"resumed":false,"version":772,"cipher_suite":4865,"proto":"h2","server_name":"castopod.satoshis-plebs.com"}},"error":"writing: http2: stream closed"}

I did run with debug on for a short period of time (including when i had an episode loop) but there is hundred of lines of output for that…I’ll include a few here that might help. I have kept all of it if need be:

330:{"level":"error","ts":1704871650.7099063,"logger":"http.log.error","msg":"dial tcp: lookup sp-app on 127.0.0.11:53: server misbehaving","request":{"remote_ip":"173.16.126.4","remote_port":"56237","client_ip":"173.16.126.4","proto":"HTTP/2.0","method":"GET","host":"castopod.satoshis-plebs.com","uri":"/sw.js","headers":{"Accept":["*/*"],"Service-Worker":["script"],"Sec-Fetch-Dest":["serviceworker"],"Referer":["https://castopod.satoshis-plebs.com/sw.js"],"Accept-Encoding":["gzip, deflate, br"],"Cache-Control":["max-age=0"],"Sec-Fetch-Mode":["same-origin"],"User-Agent":["Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36"],"Accept-Language":["en-US,en;q=0.9"],"Cookie":[],"Sec-Fetch-Site":["same-origin"]},"tls":{"resumed":true,"version":772,"cipher_suite":4865,"proto":"h2","server_name":"castopod.satoshis-plebs.com"}},"duration":0.008329717,"status":502,"err_id":"n6fyhd83a","err_trace":"reverseproxy.statusError (reverseproxy.go:1267)"}
338:{"level":"error","ts":1704871793.1645255,"logger":"http.log.error","msg":"dial tcp: lookup sp-app on 127.0.0.11:53: server misbehaving","request":{"remote_ip":"173.16.126.4","remote_port":"56237","client_ip":"173.16.126.4","proto":"HTTP/2.0","method":"GET","host":"castopod.satoshis-plebs.com","uri":"/sw.js","headers":{"Accept-Language":["en-US,en;q=0.9"],"Cookie":[],"Accept":["*/*"],"Sec-Fetch-Site":["same-origin"],"Referer":["https://castopod.satoshis-plebs.com/sw.js"],"Accept-Encoding":["gzip, deflate, br"],"User-Agent":["Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36"],"Cache-Control":["max-age=0"],"Service-Worker":["script"],"Sec-Fetch-Mode":["same-origin"],"Sec-Fetch-Dest":["serviceworker"]},"tls":{"resumed":true,"version":772,"cipher_suite":4865,"proto":"h2","server_name":"castopod.satoshis-plebs.com"}},"duration":0.00207825,"status":502,"err_id":"hg1emvv4t","err_trace":"reverseproxy.statusError (reverseproxy.go:1267)"}
344:{"level":"error","ts":1704871809.559896,"logger":"http.log.error","msg":"dial tcp: lookup sp-app on 127.0.0.11:53: server misbehaving","request":{"remote_ip":"173.16.126.4","remote_port":"56237","client_ip":"173.16.126.4","proto":"HTTP/2.0","method":"GET","host":"castopod.satoshis-plebs.com","uri":"/sw.js","headers":{"Sec-Fetch-Site":["same-origin"],"Referer":["https://castopod.satoshis-plebs.com/sw.js"],"User-Agent":["Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36"],"Accept-Encoding":["gzip, deflate, br"],"Accept-Language":["en-US,en;q=0.9"],"Service-Worker":["script"],"Accept":["*/*"],"Sec-Fetch-Mode":["same-origin"],"Sec-Fetch-Dest":["serviceworker"],"Cookie":[],"Cache-Control":["max-age=0"]},"tls":{"resumed":true,"version":772,"cipher_suite":4865,"proto":"h2","server_name":"castopod.satoshis-plebs.com"}},"duration":0.002316931,"status":502,"err_id":"y4g6nn96z","err_trace":"reverseproxy.statusError (reverseproxy.go:1267)"}

The numbers at the start of each line are line numbers in the original grep output.

PASTE OVER THIS, BETWEEN THE ``` LINES.
Please use the preview pane to ensure it looks nice.

3. Caddy version:

docker compose exec caddy caddy version
v2.7.6 h1:w0NymbG2m9PcvKWsrXO6EEkY9Ru4FJK8uQbYcev1p3A=

4. How I installed and ran Caddy:

part of a docker compose file:

 caddy:
   image: caddy:2.7.6-alpine
   container_name: "caddy"
   restart: unless-stopped
   ports:
     - "80:80"
     - "443:443"
   volumes:
     - ./caddy/Caddyfile:/etc/caddy/Caddyfile:ro
     - ./caddy/data:/data
     - ./caddy/config:/config
   networks:
     - castopod-web
     - wordpress-web
     - castopod-app

a. System environment:

ubuntu 22.04/docker

b. Command:

docker compose up -d

c. Service/unit/compose file:

PASTE OVER THIS, BETWEEN THE ``` LINES.
Please use the preview pane to ensure it looks nice.

d. My complete Caddy config:

castopod.satoshis-plebs.com {
    reverse_proxy sp-app:8000
}

5. Links to relevant resources:

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