Cannot access caddy hoster server in local network

1. Caddy version (caddy version):

2.5.1

2. How I run Caddy:

Docker with docker compose

a. System environment:

Windows 10 with Docker

b. Command:

caddy:
    container_name: caddy
    image: caddy:latest
    restart: unless-stopped
    ports:
      - 80:80
      - 443:443
    environment:
      - CADDY_INGRESS_NETWORKS=caddy
    volumes:
      - /d/Docker/Caddy/caddy_data:/data
      - /var/run/docker.sock:/var/run/docker.sock
      - /d/Docker/Caddy/caddy_config:/config
      - /d/Docker/Caddy/Caddyfile:/etc/caddy/Caddyfile

c. Service/unit/compose file:

caddy:
    container_name: caddy
    image: caddy:latest
    restart: unless-stopped
    ports:
      - 80:80
      - 443:443
    environment:
      - CADDY_INGRESS_NETWORKS=caddy
    volumes:
      - /d/Docker/Caddy/caddy_data:/data
      - /var/run/docker.sock:/var/run/docker.sock
      - /d/Docker/Caddy/caddy_config:/config
      - /d/Docker/Caddy/Caddyfile:/etc/caddy/Caddyfile

d. My complete Caddyfile or JSON config:

totallylegitmedia.duckdns.org

reverse_proxy jellyfin:8096

3. The problem I’m having:

I can access my jellyfin server with my url outside my local network but not within my LAN. I am hoping someone can help me fix this issue

4. Error messages and/or full log output:

{"level":"info","ts":1654652866.5399003,"logger":"admin","msg":"admin endpoint started","address":"tcp/localhost:2019","enforce_origin":false,"origins":["//[::1]:2019","//127.0.0.1:2019","//localhost:2019"]}

{"level":"info","ts":1654652866.540436,"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}

{"level":"info","ts":1654652866.5404646,"logger":"http","msg":"enabling automatic HTTP->HTTPS redirects","server_name":"srv0"}

{"level":"info","ts":1654652866.5417337,"logger":"tls.cache.maintenance","msg":"started background certificate maintenance","cache":"0xc0000dad90"}

{"level":"info","ts":1654652866.5423732,"logger":"tls","msg":"cleaning storage unit","description":"FileStorage:/data/caddy"}

{"level":"info","ts":1654652866.542436,"logger":"http","msg":"enabling automatic TLS certificate management","domains":["totallylegitmedia.duckdns.org"]}

{"level":"info","ts":1654652866.6207154,"msg":"autosaved config (load with --resume flag)","file":"/config/caddy/autosave.json"}

{"level":"info","ts":1654652866.6207552,"msg":"serving initial configuration"}

{"level":"info","ts":1654652866.6505127,"logger":"tls","msg":"finished cleaning storage units"}

{"level":"info","ts":1654691477.709229,"msg":"using provided configuration","config_file":"/etc/caddy/Caddyfile","config_adapter":"caddyfile"}

{"level":"warn","ts":1654691477.710589,"msg":"Caddyfile input is not formatted; run the 'caddy fmt' command to fix inconsistencies","adapter":"caddyfile","file":"/etc/caddy/Caddyfile","line":3}

{"level":"info","ts":1654691477.7123075,"logger":"admin","msg":"admin endpoint started","address":"tcp/localhost:2019","enforce_origin":false,"origins":["//localhost:2019","//[::1]:2019","//127.0.0.1:2019"]}

{"level":"info","ts":1654691477.7129345,"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}

{"level":"info","ts":1654691477.7132664,"logger":"http","msg":"enabling automatic HTTP->HTTPS redirects","server_name":"srv0"}

{"level":"info","ts":1654691477.7157297,"logger":"tls.cache.maintenance","msg":"started background certificate maintenance","cache":"0xc000287a40"}

{"level":"info","ts":1654691477.716763,"logger":"tls","msg":"cleaning storage unit","description":"FileStorage:/data/caddy"}

{"level":"info","ts":1654691477.7175372,"logger":"http","msg":"enabling automatic TLS certificate management","domains":["totallylegitmedia.duckdns.org"]}

{"level":"info","ts":1654691477.7786956,"logger":"tls","msg":"finished cleaning storage units"}

{"level":"info","ts":1654691477.7794764,"msg":"autosaved config (load with --resume flag)","file":"/config/caddy/autosave.json"}

{"level":"info","ts":1654691477.7795296,"msg":"serving initial configuration"}

{"level":"info","ts":1654723822.9323795,"msg":"using provided configuration","config_file":"/etc/caddy/Caddyfile","config_adapter":"caddyfile"}

{"level":"warn","ts":1654723822.9356189,"msg":"Caddyfile input is not formatted; run the 'caddy fmt' command to fix inconsistencies","adapter":"caddyfile","file":"/etc/caddy/Caddyfile","line":3}

{"level":"info","ts":1654723822.94291,"logger":"admin","msg":"admin endpoint started","address":"tcp/localhost:2019","enforce_origin":false,"origins":["//[::1]:2019","//127.0.0.1:2019","//localhost:2019"]}

{"level":"info","ts":1654723822.9440405,"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}

{"level":"info","ts":1654723822.9441254,"logger":"http","msg":"enabling automatic HTTP->HTTPS redirects","server_name":"srv0"}

{"level":"info","ts":1654723822.9445345,"logger":"tls.cache.maintenance","msg":"started background certificate maintenance","cache":"0xc00058bf10"}

{"level":"info","ts":1654723822.9447203,"logger":"tls","msg":"cleaning storage unit","description":"FileStorage:/data/caddy"}

{"level":"info","ts":1654723822.9449348,"logger":"http","msg":"enabling automatic TLS certificate management","domains":["totallylegitmedia.duckdns.org"]}

{"level":"info","ts":1654723822.9954762,"logger":"tls","msg":"finished cleaning storage units"}

{"level":"info","ts":1654723823.0062072,"msg":"autosaved config (load with --resume flag)","file":"/config/caddy/autosave.json"}

{"level":"info","ts":1654723823.0062478,"msg":"serving initial configuration"}

{"level":"info","ts":1654767023.3416684,"logger":"tls.cache.maintenance","msg":"advancing OCSP staple","identifiers":["totallylegitmedia.duckdns.org"],"from":1655067598,"to":1655283598}

{"level":"info","ts":1654816080.4268916,"msg":"using provided configuration","config_file":"/etc/caddy/Caddyfile","config_adapter":"caddyfile"}

{"level":"warn","ts":1654816080.4275625,"msg":"Caddyfile input is not formatted; run the 'caddy fmt' command to fix inconsistencies","adapter":"caddyfile","file":"/etc/caddy/Caddyfile","line":3}

{"level":"info","ts":1654816080.4294076,"logger":"admin","msg":"admin endpoint started","address":"tcp/localhost:2019","enforce_origin":false,"origins":["//localhost:2019","//[::1]:2019","//127.0.0.1:2019"]}

{"level":"info","ts":1654816080.430181,"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}

{"level":"info","ts":1654816080.430212,"logger":"http","msg":"enabling automatic HTTP->HTTPS redirects","server_name":"srv0"}

{"level":"info","ts":1654816080.4308906,"logger":"tls.cache.maintenance","msg":"started background certificate maintenance","cache":"0xc00045bdc0"}

{"level":"info","ts":1654816080.432954,"logger":"http","msg":"enabling automatic TLS certificate management","domains":["totallylegitmedia.duckdns.org"]}

{"level":"info","ts":1654816080.7803078,"logger":"tls","msg":"cleaning storage unit","description":"FileStorage:/data/caddy"}

{"level":"info","ts":1654816080.7838006,"msg":"autosaved config (load with --resume flag)","file":"/config/caddy/autosave.json"}

{"level":"info","ts":1654816080.7838507,"msg":"serving initial configuration"}

{"level":"info","ts":1654816080.8266206,"logger":"tls","msg":"finished cleaning storage units"}

{"level":"info","ts":1654861950.641935,"msg":"using provided configuration","config_file":"/etc/caddy/Caddyfile","config_adapter":"caddyfile"}

{"level":"warn","ts":1654861950.6426287,"msg":"Caddyfile input is not formatted; run the 'caddy fmt' command to fix inconsistencies","adapter":"caddyfile","file":"/etc/caddy/Caddyfile","line":3}

{"level":"info","ts":1654861950.6443796,"logger":"admin","msg":"admin endpoint started","address":"tcp/localhost:2019","enforce_origin":false,"origins":["//localhost:2019","//[::1]:2019","//127.0.0.1:2019"]}

{"level":"info","ts":1654861950.644788,"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}

{"level":"info","ts":1654861950.6448188,"logger":"http","msg":"enabling automatic HTTP->HTTPS redirects","server_name":"srv0"}

{"level":"info","ts":1654861950.6462758,"logger":"tls.cache.maintenance","msg":"started background certificate maintenance","cache":"0xc0004167e0"}

{"level":"info","ts":1654861950.6463406,"logger":"tls","msg":"cleaning storage unit","description":"FileStorage:/data/caddy"}

{"level":"info","ts":1654861950.6464622,"logger":"http","msg":"enabling automatic TLS certificate management","domains":["totallylegitmedia.duckdns.org"]}

{"level":"info","ts":1654861950.7090907,"msg":"autosaved config (load with --resume flag)","file":"/config/caddy/autosave.json"}

{"level":"info","ts":1654861950.7091272,"msg":"serving initial configuration"}

{"level":"info","ts":1654861950.7186823,"logger":"tls","msg":"finished cleaning storage units"}

{"level":"info","ts":1654898814.635301,"msg":"using provided configuration","config_file":"/etc/caddy/Caddyfile","config_adapter":"caddyfile"}

{"level":"warn","ts":1654898814.6359599,"msg":"Caddyfile input is not formatted; run the 'caddy fmt' command to fix inconsistencies","adapter":"caddyfile","file":"/etc/caddy/Caddyfile","line":3}

{"level":"info","ts":1654898814.6400375,"logger":"admin","msg":"admin endpoint started","address":"tcp/localhost:2019","enforce_origin":false,"origins":["//localhost:2019","//[::1]:2019","//127.0.0.1:2019"]}

{"level":"info","ts":1654898814.641552,"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}

{"level":"info","ts":1654898814.6416473,"logger":"http","msg":"enabling automatic HTTP->HTTPS redirects","server_name":"srv0"}

{"level":"info","ts":1654898814.642249,"logger":"tls.cache.maintenance","msg":"started background certificate maintenance","cache":"0xc0004176c0"}

{"level":"info","ts":1654898814.6451156,"logger":"http","msg":"enabling automatic TLS certificate management","domains":["totallylegitmedia.duckdns.org"]}

{"level":"info","ts":1654898814.6460726,"logger":"tls","msg":"cleaning storage unit","description":"FileStorage:/data/caddy"}

{"level":"info","ts":1654898814.7027059,"logger":"tls","msg":"finished cleaning storage units"}

{"level":"info","ts":1654898814.7259548,"msg":"autosaved config (load with --resume flag)","file":"/config/caddy/autosave.json"}

{"level":"info","ts":1654898814.725995,"msg":"serving initial configuration"}

{"level":"info","ts":1654929862.5003338,"msg":"using provided configuration","config_file":"/etc/caddy/Caddyfile","config_adapter":"caddyfile"}

{"level":"warn","ts":1654929862.5009656,"msg":"Caddyfile input is not formatted; run the 'caddy fmt' command to fix inconsistencies","adapter":"caddyfile","file":"/etc/caddy/Caddyfile","line":3}

{"level":"info","ts":1654929862.5047526,"logger":"admin","msg":"admin endpoint started","address":"tcp/localhost:2019","enforce_origin":false,"origins":["//[::1]:2019","//127.0.0.1:2019","//localhost:2019"]}

{"level":"info","ts":1654929862.5052748,"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}

{"level":"info","ts":1654929862.5053067,"logger":"http","msg":"enabling automatic HTTP->HTTPS redirects","server_name":"srv0"}

{"level":"info","ts":1654929862.5064712,"logger":"tls.cache.maintenance","msg":"started background certificate maintenance","cache":"0xc0002c20e0"}

{"level":"info","ts":1654929862.5069196,"logger":"http","msg":"enabling automatic TLS certificate management","domains":["totallylegitmedia.duckdns.org"]}

{"level":"info","ts":1654929862.576419,"logger":"tls","msg":"cleaning storage unit","description":"FileStorage:/data/caddy"}

{"level":"info","ts":1654929862.579446,"msg":"autosaved config (load with --resume flag)","file":"/config/caddy/autosave.json"}

{"level":"info","ts":1654929862.5794797,"msg":"serving initial configuration"}

{"level":"info","ts":1654929862.6303682,"logger":"tls","msg":"finished cleaning storage units"}

{"level":"info","ts":1654974322.1444533,"msg":"using provided configuration","config_file":"/etc/caddy/Caddyfile","config_adapter":"caddyfile"}

{"level":"warn","ts":1654974322.1514204,"msg":"Caddyfile input is not formatted; run the 'caddy fmt' command to fix inconsistencies","adapter":"caddyfile","file":"/etc/caddy/Caddyfile","line":3}

{"level":"info","ts":1654974322.1527903,"logger":"admin","msg":"admin endpoint started","address":"tcp/localhost:2019","enforce_origin":false,"origins":["//localhost:2019","//[::1]:2019","//127.0.0.1:2019"]}

{"level":"info","ts":1654974322.153597,"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}

{"level":"info","ts":1654974322.1536348,"logger":"http","msg":"enabling automatic HTTP->HTTPS redirects","server_name":"srv0"}

{"level":"info","ts":1654974322.1553104,"logger":"tls.cache.maintenance","msg":"started background certificate maintenance","cache":"0xc00048e850"}

{"level":"info","ts":1654974322.1581807,"logger":"tls","msg":"cleaning storage unit","description":"FileStorage:/data/caddy"}

{"level":"info","ts":1654974322.1612003,"logger":"http","msg":"enabling automatic TLS certificate management","domains":["totallylegitmedia.duckdns.org"]}

{"level":"info","ts":1654974322.1921124,"msg":"autosaved config (load with --resume flag)","file":"/config/caddy/autosave.json"}

{"level":"info","ts":1654974322.1921475,"msg":"serving initial configuration"}

{"level":"info","ts":1654974322.1936836,"logger":"tls","msg":"finished cleaning storage units"}

{"level":"info","ts":1654981522.4871435,"logger":"tls.cache.maintenance","msg":"advancing OCSP staple","identifiers":["totallylegitmedia.duckdns.org"],"from":1655283598,"to":1655499598}

{"level":"info","ts":1655056598.0902433,"msg":"using provided configuration","config_file":"/etc/caddy/Caddyfile","config_adapter":"caddyfile"}

{"level":"warn","ts":1655056598.0909755,"msg":"Caddyfile input is not formatted; run the 'caddy fmt' command to fix inconsistencies","adapter":"caddyfile","file":"/etc/caddy/Caddyfile","line":3}

{"level":"info","ts":1655056598.0926852,"logger":"admin","msg":"admin endpoint started","address":"tcp/localhost:2019","enforce_origin":false,"origins":["//localhost:2019","//[::1]:2019","//127.0.0.1:2019"]}

{"level":"info","ts":1655056598.09462,"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}

{"level":"info","ts":1655056598.0946515,"logger":"http","msg":"enabling automatic HTTP->HTTPS redirects","server_name":"srv0"}

{"level":"info","ts":1655056598.0957637,"logger":"tls.cache.maintenance","msg":"started background certificate maintenance","cache":"0xc000021b90"}

{"level":"info","ts":1655056598.096385,"logger":"http","msg":"enabling automatic TLS certificate management","domains":["totallylegitmedia.duckdns.org"]}

{"level":"info","ts":1655056598.0970795,"logger":"tls","msg":"cleaning storage unit","description":"FileStorage:/data/caddy"}

{"level":"info","ts":1655056598.2130432,"logger":"tls","msg":"finished cleaning storage units"}

{"level":"info","ts":1655056598.5616732,"msg":"autosaved config (load with --resume flag)","file":"/config/caddy/autosave.json"}

{"level":"info","ts":1655056598.5617094,"msg":"serving initial configuration"}

{"level":"error","ts":1655082588.7052433,"logger":"http.handlers.reverse_proxy","msg":"aborting with incomplete response","error":"http2: stream closed"}

4.1. Curl -v output

/srv # curl -v totallylegitmedia.duckdns.org
*   Trying my ip:80...
* connect to my ip port 80 failed: Connection refused
* Failed to connect to totallylegitmedia.duckdns.org port 80 after 21235 ms: Connection refused
* Closing connection 0
curl: (7) Failed to connect to totallylegitmedia.duckdns.org port 80 after 21235 ms: Connection refused

5. What I already tried:

I have tried resetting certificates and different reverse_proxy commands in my caddyfile (ex. jellyfin:8096, localhost:8096, myip:8096

6. Links to relevant resources:

none currently

My guess is your home router does not support hairpin NAT.

I can access my server with my public ip and localhost but not the url with caddy. I have an ISP provided router with xfinity and use eero as range extenders.

What evidence do you have of that? (I believe you, but we need curl -v commands and its output, like the help template asks for.)

I have edited my post to add curl -v output.