Cant Load Domain?

1. Caddy version (caddy version):

Caddy v2.3.0

2. How I run Caddy:

a. System environment:

Ubuntu 20.04 systemd

c. Service/unit/compose file:


d. My complete Caddyfile or JSON config:

requests.movies4you.stream {
    reverse_proxy 192.168.1.116:5000
    tls {
        dns cloudflare api-key
    }
}
accounts.movies4you.stream {
    reverse_proxy 192.168.1.116:8056
    tls {
        dns cloudflare api-key
    }
}
stream.movies4you.stream {
    reverse_proxy 192.168.1.116:8096
    tls {
        dns cloudflare api-key
    }
}
photos.techjunkiehosting.com {
    reverse_proxy 192.168.1.116:2342
    tls {
        dns cloudflare api-key
    }
}

3. The problem I’m having:

4. Error messages and/or full log output:

the system processes and successfully completes all domain requests.

5. What I already tried:

I have open port 443 and 80
sudo ufw allow 443/tcp
sudo ufw allow 80/tcp
sudo ufw allow 53/tcp
I have also open these same ports under portfowarding on my router.
Im pretty sure something is not working correctly. I recently moved to a new location and had to replace my router and modem. I have a new external ip adress in which i have changed in my cloudflare account to be correct. The problem i remember the last time was something in my router settings was causing port 443 and 80 to not be opened. I posted on here. But cannot find the post. I dont remember how i fixed it. What i do remember it was the same exact router and third party firmware. Ive also tried open port checker with no luck. Im 100% its something in my router setttings as i had this issue in the past at my old home network infrastructure. Could anyone advise. I am running DDWRT on an Linksys WRT1200-AC. Thank you ahead of time.

6. Links to relevant resources:

Open Port Checker
https://portchecker.co/

What are in your logs? If you’re running as a systemd service, you can run this to see them: journalctl -u caddy --no-pager | less

-- Logs begin at Thu 2021-02-18 13:00:32 CST, end at Thu 2021-02-18 13:36:35 CST. --
Feb 18 13:36:15 Gaming-Server systemd[1]: Stopping Caddy...
Feb 18 13:36:15 Gaming-Server caddy[2997242]: {"level":"info","ts":1613676975.750817,"msg":"shutting down apps then terminating","signal":"SIGTERM"}
Feb 18 13:36:16 Gaming-Server caddy[2997242]: {"level":"info","ts":1613676976.813588,"logger":"tls.cache.maintenance","msg":"stopped background certificate maintenance","cache":"0xc0003857a0"}
Feb 18 13:36:17 Gaming-Server caddy[2997242]: {"level":"info","ts":1613676977.3572965,"logger":"admin","msg":"stopped previous server"}
Feb 18 13:36:17 Gaming-Server caddy[2997242]: {"level":"info","ts":1613676977.360194,"msg":"shutdown done","signal":"SIGTERM"}
Feb 18 13:36:17 Gaming-Server systemd[1]: caddy.service: Succeeded.
Feb 18 13:36:17 Gaming-Server systemd[1]: Stopped Caddy.
Feb 18 13:36:17 Gaming-Server systemd[1]: Started Caddy.
Feb 18 13:36:17 Gaming-Server caddy[443464]: caddy.HomeDir=/var/lib/caddy
Feb 18 13:36:17 Gaming-Server caddy[443464]: caddy.AppDataDir=/var/lib/caddy/.local/share/caddy
Feb 18 13:36:17 Gaming-Server caddy[443464]: caddy.AppConfigDir=/var/lib/caddy/.config/caddy
Feb 18 13:36:17 Gaming-Server caddy[443464]: caddy.ConfigAutosavePath=/var/lib/caddy/.config/caddy/autosave.json

sorry been messing with my network infrastructure. I just got my ap working again

That’s just the first few lines of the logs. Where’s the rest?

I apoligize I had to press enter to view the entire log here it is

-- Logs begin at Fri 2021-02-19 02:30:40 CST, end at Fri 2021-02-19 03:21:01 CST. --
Feb 19 03:20:09 Gaming-Server systemd[1]: Reloading Caddy.
Feb 19 03:20:10 Gaming-Server caddy[990658]: {"level":"info","ts":1613726410.0068698,"msg":"using provided configuration","config_file":"/etc/caddy/Caddyfile","config_adapter":""}
Feb 19 03:20:10 Gaming-Server caddy[443464]: {"level":"info","ts":1613726410.1040866,"logger":"admin.api","msg":"received request","method":"POST","host":"localhost:2019","uri":"/load","remote_addr":"127.0.0.1:51412","headers":{"Accept-Encoding":["gzip"],"Content-Length":["1169"],"Content-Type":["application/json"],"Origin":["localhost:2019"],"User-Agent":["Go-http-client/1.1"]}}
Feb 19 03:20:10 Gaming-Server caddy[443464]: {"level":"info","ts":1613726410.109183,"logger":"admin.api","msg":"config is unchanged"}
Feb 19 03:20:10 Gaming-Server caddy[443464]: {"level":"info","ts":1613726410.1092038,"logger":"admin.api","msg":"load complete"}
Feb 19 03:20:10 Gaming-Server systemd[1]: Reloaded Caddy.
Feb 19 03:20:35 Gaming-Server systemd[1]: Stopping Caddy...
Feb 19 03:20:35 Gaming-Server caddy[443464]: {"level":"info","ts":1613726435.5004742,"msg":"shutting down apps then terminating","signal":"SIGTERM"}
Feb 19 03:20:36 Gaming-Server caddy[443464]: {"level":"info","ts":1613726436.5516357,"logger":"tls.cache.maintenance","msg":"stopped background certificate maintenance","cache":"0xc0003eee70"}
Feb 19 03:20:37 Gaming-Server caddy[443464]: {"level":"info","ts":1613726437.0519211,"logger":"admin","msg":"stopped previous server"}
Feb 19 03:20:37 Gaming-Server caddy[443464]: {"level":"info","ts":1613726437.05196,"msg":"shutdown done","signal":"SIGTERM"}
Feb 19 03:20:37 Gaming-Server systemd[1]: caddy.service: Succeeded.
Feb 19 03:20:37 Gaming-Server systemd[1]: Stopped Caddy.
Feb 19 03:20:37 Gaming-Server systemd[1]: Started Caddy.
Feb 19 03:20:37 Gaming-Server caddy[991080]: caddy.HomeDir=/var/lib/caddy
Feb 19 03:20:37 Gaming-Server caddy[991080]: caddy.AppDataDir=/var/lib/caddy/.local/share/caddy
Feb 19 03:20:37 Gaming-Server caddy[991080]: caddy.AppConfigDir=/var/lib/caddy/.config/caddy
Feb 19 03:20:37 Gaming-Server caddy[991080]: caddy.ConfigAutosavePath=/var/lib/caddy/.config/caddy/autosave.json
Feb 19 03:20:37 Gaming-Server caddy[991080]: caddy.Version=v2.3.0
Feb 19 03:20:37 Gaming-Server caddy[991080]: runtime.GOOS=linux
Feb 19 03:20:37 Gaming-Server caddy[991080]: runtime.GOARCH=amd64
Feb 19 03:20:37 Gaming-Server caddy[991080]: runtime.Compiler=gc
Feb 19 03:20:37 Gaming-Server caddy[991080]: runtime.NumCPU=4
Feb 19 03:20:37 Gaming-Server caddy[991080]: runtime.GOMAXPROCS=4
Feb 19 03:20:37 Gaming-Server caddy[991080]: runtime.Version=go1.15.6
Feb 19 03:20:37 Gaming-Server caddy[991080]: os.Getwd=/
Feb 19 03:20:37 Gaming-Server caddy[991080]: LANG=en_AU.UTF-8
Feb 19 03:20:37 Gaming-Server caddy[991080]: PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin
Feb 19 03:20:37 Gaming-Server caddy[991080]: HOME=/var/lib/caddy
Feb 19 03:20:37 Gaming-Server caddy[991080]: LOGNAME=caddy
Feb 19 03:20:37 Gaming-Server caddy[991080]: USER=caddy
Feb 19 03:20:37 Gaming-Server caddy[991080]: INVOCATION_ID=7005e575c19c4a46b624e8be4a7b2c13
Feb 19 03:20:37 Gaming-Server caddy[991080]: JOURNAL_STREAM=8:78508917
Feb 19 03:20:37 Gaming-Server caddy[991080]: {"level":"info","ts":1613726437.2206926,"msg":"using provided configuration","config_file":"/etc/caddy/Caddyfile","config_adapter":""}
Feb 19 03:20:37 Gaming-Server caddy[991080]: {"level":"info","ts":1613726437.2743118,"logger":"admin","msg":"admin endpoint started","address":"tcp/localhost:2019","enforce_origin":false,"origins":["localhost:2019","[::1]:2019","127.0.0.1:2019"]}
Feb 19 03:20:37 Gaming-Server caddy[991080]: {"level":"info","ts":1613726437.2941704,"logger":"tls.cache.maintenance","msg":"started background certificate maintenance","cache":"0xc00031c000"}
Feb 19 03:20:37 Gaming-Server caddy[991080]: {"level":"info","ts":1613726437.3438363,"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}
Feb 19 03:20:37 Gaming-Server caddy[991080]: {"level":"info","ts":1613726437.3438659,"logger":"http","msg":"enabling automatic HTTP->HTTPS redirects","server_name":"srv0"}
Feb 19 03:20:37 Gaming-Server caddy[991080]: {"level":"info","ts":1613726437.3444803,"logger":"http","msg":"enabling automatic TLS certificate management","domains":["requests.movies4you.stream","accounts.movies4you.stream","stream.movies4you.stream","photos.techjunkiehosting.com"]}
Feb 19 03:20:37 Gaming-Server caddy[991080]: {"level":"info","ts":1613726437.9919736,"logger":"tls","msg":"cleaned up storage units"}
Feb 19 03:20:38 Gaming-Server caddy[991080]: {"level":"info","ts":1613726438.1796124,"msg":"autosaved config","file":"/var/lib/caddy/.config/caddy/autosave.json"}
Feb 19 03:20:38 Gaming-Server caddy[991080]: {"level":"info","ts":1613726438.1796396,"msg":"serving initial configuration"}

Any ideas on the logs???

Edit #1: okay for some odd reason every time I type my domain it takes me to my router login??

Your local DNS server needs to resolve the domain name to the IP address of your Caddy reverse proxy. It’s the same IP address that you specify in your port forward on the router.

??? could you eleborate my cloudflare runs my external ip adress of my home internet. Then i have a cname off the cloudflare linking to the domain name. Then a A record for home internet external ip adress using ipchicken. Are you saying i need to run my static ip that is running the jellyfin ie. localhost instead of 192.168.1.xxx. i also have my cloudflare NS on my domain registar linked to my domain.

What you have is a split DNS arrangement.

On the internet, Cloudflare acts as your external DNS resolver and resolves your domain name to your external IP address. Through port forwarding, your Caddy reverse proxy directs external clients to the correct local server.

On the private network, your local DNS resolver has to resolve the domain name to the IP address of the Caddy reverse proxy. The Caddy reverse proxy then directs local clients to the correct local server.

For more details, refer to the Wiki article Using Caddy as a reverse proxy in a home network

2 Likes

I read i need to setup a DYNAMIC DNS in my router configuartion using ddwrt third party firmware. like in here. router - Using dd-wrt Dynamic DNS client with CloudFlare - Server Fault
is that correct or could you go into more detail/example configuration ie dydns setup in ddwrt or like shown above at the link using the bottom post on that forum post

DynDNS is just one piece of the puzzle. That ensures that your domain always points to the correct IP for clients outside of your local network.

But while inside of your network, if you try to connect to your WAN IP, your router probably doesn’t understand how to loop back requests to the WAN IP back into the network to your server. Since you’re using DD-WRT, look around the settings for something called “NAT loopback” or “NAT redirection”, and make sure that’s turned on, that might fix the issue.

1 Like

aaah thank you i will test in a second. Two more questions. Do i need to port forward on router 8096 for ie jellyfin or 5000 for ombi, or can my workstation running barebones linux do that. Also if im running barebones and running docker inside the barebones OS. How do i run caddy from that docker if i already have my Caddyfile setup in my barebones OS. Do i need to run a caddy container and the caddy barebones? I would prefer to seperate certain apps in barebones and docker

No, you port forward 80 and 443 to your server running Caddy, and the rest of the ports stay internal to your local network. This is explained in this article:

1 Like

okay i already had that i just wanted to double check. I have enabled this setting which is the only one that i could find. is this correct.

Also I about the docker could you possibly answer that question asked here

its still not working??? Is there anything else I should be doing/enabling? I have give it 4+ hrs to propegate and still not loading my domains? Plus could you answer the docker question above

Are you still getting your router’s web page when you type in your domain, or is it simply not loading (i.e. timeout)?

Caddy doesn’t care whether it’s run in Docker or on the host itself. The same Caddyfile applies. You just need to ensure that Docker has ports 80/443 forwarded to Caddy’s container (the exact same concept as applies to forwarding 80/443 from your router to your server).

The only things that might need adjusting are webroots if you have those in relatively different locations inside the container, and upstreams (you’ll need to point those at adjacent containers and/or the host since localhost etc won’t work; looks like you use 192.168 addresses for upstreams, though, so this should probably be fine).

1 Like

its simply not loading now it just loads like the below picture

FYI: I changed stream.domain.com to tv.domain.com i made the required edits in Caddyfile and the cloudflare

Run this command:

dig TXT +short o-o.myaddr.l.google.com @ns1.google.com

Then run this command:

dig +short tv.movies4you.stream

And ensure they both produce the same IP address.

If they are the same, you likely need to revisit your router’s port forwarding.

1 Like