Problem while reverse proxying jellyfin

1. Caddy version (caddy version):

v2.1.1

2. How I run Caddy:

sudo systemctl start caddy or sudo systemctl reload caddy (restarting caddy)

a. System environment:

Linux 64-bit, Pop!_OS 20.04 LTS, no Docker

b. Command:

sudo systemctl start caddy

c. Service/unit/compose file:

N/A

d. My complete Caddyfile or JSON config:

jellyfin.domain.com {

reverse_proxy 127.0.0.1:8096

}

3. The problem I’m having:

When I head to the site where the server is supposed to be located jellyfin.domain.com the server does not load, and shows an unable to connect screen.

4. Error messages and/or full log output:

The connection has timed out

The server at jellyfin.domain.com is taking too long to respond.

5. What I already tried:

I set up an A record in my DNS for my site using my public ip-address, and port forwarded 80, 443, 8096 with my internal ip-address.

6. Links to relevant resources:

Followed jellyfin caddy installation here
Also tried using this tutorial from matt here

Could you please fill out the help thread template? You originally made your post on the wiki category which doesn’t include the template, and we ask users to fill it out so we can properly understand the issue they’re facing.

Right now it’s unclear to me what the issue is. Please post your caddy version, full logs, and please use curl -v to make a request to Caddy so we can see what the response looks like.

I have adjusted the format, first time here so did not know about the format required.

Are you trying to connect to your server from inside of the same network? Try connecting to it from your phone over your cellular connection (not wifi) to see if it works.

To quote Matt’s guide on home networks:

What I do personally is I also also expose my server on some other port like 8000 so it’s accessible inside my local network over HTTP, but running a DNS server is a better solution if you’re willing to spend a bit more time setting that up. Here’s how it looks for me:

jellyfin.example.com, :8000 {
	reverse_proxy 127.0.0.1:8096
}

is that colon supposed to be there? and what would I bind the port 8000?

Yes, the colon tells Caddy that that’s a port. That just tells Caddy “also serve the site to any client connecting on port 8000”. The port number you want to use is totally up to you.

Did you try connecting to your site from outside your network (i.e. from your cell phone, off-wifi)?

Yes, it showed the Caddy congratulations page. However, not the actual jellyfin server.

Oh, did you edit the config in /etc/caddy/Caddyfile? That’s the default config location used when running Caddy as a service. If your Caddyfile is saved elsewhere, Caddy won’t know to load it from there unless you tell it to (change the service file to point to the new location); but I recommend just editing the config in /etc/caddy/Caddyfile.

yes the edits are made in the /etc/caddy/Caddyfile

Then what are its full contents?

You should not see the default Caddy welcome page if you correctly reloaded Caddy after having made edits there.

the full Caddyfile is:

jellyfin.domain.xyz {

reverse-proxy 127.0.0.1:8096

}

I use the command sudo systemctl reload caddy to reload it.

I noticed that there were 2 caddy files so I deleted CaddyFile and edited Caddyfile. Now the contents of the file is:

# The Caddyfile is an easy way to configure your Caddy web server.
#
# Unless the file starts with a global options block, the first
# uncommented line is always the address of your site.
#
# To use your own domain name (with automatic HTTPS), first make
# sure your domain's A/AAAA DNS records are properly pointed to
# this machine's public IP, then replace the line below with your
# domain name.

jellyfin.domain.xyz       {
        reverse_proxy 127.0.0.1:8096
}

When I go to the site from my internal network it does not load, shows a The connection has timed out
The server at jellyfin.domain.xyz is taking too long to respond. And when I try going to the site from my phone (DATA ON) it takes me to the caddy congratulations webpage.

Did you reload Caddy after deleting/editing?

What do your Caddy logs say? You can run journalctl -xe caddy | less to see them (and hit q to quit when you’re done copying).

Gives me an error Failed to add match 'caddy': Invalid argument
and as I go to the site from my phone (with/without) data, the site loads up to the caddy congratulations page. When I try the computer it says The connection has timed out The server at jellyfin.domain.xyz is taking too long to respond.

Whoops my bad, wrong command. Use this:

journalctl --no-pager -u caddy | less

Hit Shift+g to jump to the bottom of your logs, then use the arrow keys to go up and down.

how far down should I go?

Yes, caddy is running, the output is:

caddy.service - Caddy
     Loaded: loaded (/lib/systemd/system/caddy.service; enabled; vendor prese>
     Active: active (running) since Sat 2020-08-22 19:28:52 EDT; 25min ago
       Docs: https://caddyserver.com/docs/
   Main PID: 404861 (caddy)
      Tasks: 17 (limit: 19018)
     Memory: 11.8M
     CGroup: /system.slice/caddy.service
             └─404861 /usr/bin/caddy run --environ --config /etc/caddy/Caddyf>

Aug 22 19:28:52 h-pc caddy[404861]: {"level":"info","ts":1598138932.4112>
Aug 22 19:28:52 h-pc caddy[404861]: 2020/08/22 19:28:52 [INFO][cache:0xc>
Aug 22 19:28:52 h-pc caddy[404861]: {"level":"info","ts":1598138932.4128>
Aug 22 19:28:52 h-pc caddy[404861]: {"level":"info","ts":1598138932.4131>
Aug 22 19:28:52 h-pc caddy[404861]: {"level":"info","ts":1598138932.4141>
Aug 22 19:28:52 h-pc caddy[404861]: {"level":"info","ts":1598138932.4144>
Aug 22 19:28:52 h-pc caddy[404861]: {"level":"info","ts":1598138932.4242>
Aug 22 19:28:52 h-pc caddy[404861]: {"level":"info","ts":1598138932.4242>
Aug 22 19:36:23 h-pc caddy[404861]: {"level":"info","ts":1598139383.1316>
Aug 22 19:36:23 h-pc caddy[404861]: {"level":"info","ts":1598139383.3221>

sorry the time limit is still there but this is from the end of the logs:
Aug 22 21:25:15 h-pc caddy[407309]: {"level":"info","ts":1598145915.740489,"logger":"admin","msg":"admin endpoint started","address":"tcp/localhost:2019","enforce_origin":false,"origins":["localhost:2019","[::1]:2019","127.0.0.1:2019"]}
Aug 22 21:25:15 h-pc caddy[407309]: {"level":"info","ts":1598145915.740622,"logger":"http","msg":"server is listening only on the HTTPS port but has no TLS connection policies; adding one to enable TLS","server_name":"srv0","https_port":443}
Aug 22 21:25:15 h-pc caddy[407309]: {"level":"info","ts":1598145915.740633,"logger":"http","msg":"enabling automatic HTTP->HTTPS redirects","server_name":"srv0"}
Aug 22 21:25:15 h-pc caddy[407309]: 2020/08/22 21:25:15 [INFO][cache:0xc00011a480] Started certificate maintenance routine
Aug 22 21:25:15 h-pc caddy[407309]: {"level":"info","ts":1598145915.7421753,"logger":"tls","msg":"cleaned up storage units"}
Aug 22 21:25:15 h-pc caddy[407309]: {"level":"info","ts":1598145915.74294,"logger":"http","msg":"enabling automatic TLS certificate management","domains":["jellyfin.domain.xyz"]}
Aug 22 21:25:15 h-pc caddy[407309]: {"level":"info","ts":1598145915.7554736,"msg":"autosaved config","file":"/var/lib/caddy/.config/caddy/autosave.json"}
Aug 22 21:25:15 h-pc caddy[407309]: {"level":"info","ts":1598145915.7554977,"msg":"serving initial configuration"}

Well the top of your logs are from yesterday. We need to see the startup sequence from the last time Caddy started.

What does sudo systemctl status caddy say? Is it even running right now?

Thanks for posting the status, that’s good. But I still haven’t seen your logs, they’re truncated when you run status.

I just bumped up your trust level, I think you should be able to post again. I figured you hit the first day reply limit.