Reverse Proxy no longer working

1. Caddy version (caddy version):

Caddy v2.1.1

2. How I run Caddy:

I run Caddy in a Docker container in network bridge mode, as it is on a macOS host. It’s volumes are all binded to volumes on the host computer.

a. System environment:

macOS - Docker

b. Command:

'caddy' 'run' '--config' '/etc/caddy/Caddyfile' '--adapter' 'caddyfile'

d. My complete Caddyfile or JSON config:

iwolfking.xyz, www.iwolfking.xyz
{
	root * /usr/share/caddy/site
	file_server
}
cocktail.iwolfking.xyz
{
	root * /usr/share/caddy/cocktail
	file_server
}
jelly.iwolfking.xyz {
	reverse_proxy http://192.168.0.18:8096
}

3. The problem I’m having:

I use to have a working reverse proxy for my Jellyfin server, but now it is no longer working properly and gives me a 502 error, previously it worked perfectly fine with no issues.

All of a sudden one day this stopped working and I have been unable to get it working again, only receiving the 502 error.

You’ll note that I also have a couple sites served up, these actually work perfectly fine, although I don’t have them actually up at the moment. This makes me especially confused about why the reverse proxy no longer works. It is not a Jellyfin specific issue either, I have tried several other services and the same issue happens now.

4. Error messages and/or full log output:

{“level”:“error”,“ts”:1595892752.4193504,“logger”:“http.log.error”,“msg”:“dial tcp 192.168.0.18:8096: i/o timeout”,“request”:{“method”:“GET”,“uri”:"/favicon.ico",“proto”:“HTTP/2.0”,“remote_addr”:“172.17.0.1:38956”,“host”:“jelly.iwolfking.xyz”,“headers”:{“User-Agent”:[“Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Firefox/78.0”],“Accept”:[“image/webp,/”],“Accept-Language”:[“en-US,en;q=0.5”],“Accept-Encoding”:[“gzip, deflate, br”],“Te”:[“trailers”]},“tls”:{“resumed”:true,“version”:772,“ciphersuite”:4865,“proto”:“h2”,“proto_mutual”:true,“server_name”:“jelly.iwolfking.xyz”}},“duration”:10.00855454,“status”:502,“err_id”:“4nfgftghp”,“err_trace”:“reverseproxy.(*Handler).ServeHTTP (reverseproxy.go:411)”}

5. What I already tried:

I have tested other services with the reverse proxy to see if it was related to that specific service, but unfortunately not. I have tried looking up different config settings that I could/should use, but no matter what I put it no longer works as it used to. I have tried from several different browsers and computers.

Are you sure your service at 192.168.0.18:8096 is still running? Might there be any firewall rules causing the connection to fail?

I don’t think this is an issue with Caddy, it must be an issue with your backend service or with your network.

Yeah, thanks for asking.

It is definitely running, I can reach it just fine if I type that in on any of my local machines. I have a VPN I can use to connect to my home network and then it also works to connect through that as well, away from home.

Doing some more testing, I moved caddy into a different Docker network and just used the containername:port way of connecting and it actually managed to serve that up fine, so I’m going to chalk that up to Caddy not being able to reach it due to docker network issues (not sure why it was working previously and broke though).

2 Likes

Thanks for following up :smile:

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