Caddy on LAN only

1.6k Views Asked by At

I am trying to setup a reverse proxy with Caddy, I also want to use subdomains to point to my different services, so I bought a domain but the domain can only point to an ip-address, and my routers ip-address is not static so to solve that I registered a subdomain on Duckdns and that subdomain is pointing to my routers ip-address all the time, the subdomains on that I payed for have DNS set to point to Duckdns and I have opened port 80 & 443 on my router to point to my server machine that is running Caddy, the caddyfile simply have the domains I payed for point to localhost services.

It works but only on LAN, outside it does not work

1

There are 1 best solutions below

0
On
  1. If your public IP address is not the same as nslookup mydomain.duckdns.org; the problem is DNS. check your dynamic DNS client's configuration file for inaccuracies. Restart your router and trial that it works as expected
  2. If the IP addresses match, but you cannot make access from outside the network, its a port forwarding issue. Check port forwarding rules on your router, and opened ports on your server.

sudo ufw status verbose and sudo ss -ltnp are helpful server commands.

  1. If the IP addresses match, but you cannot make access from inside the network, hairpin NAT is the issue. This is a router issue. Buy a more feature complete router from your ISP, or setup a local DNS server to resolve this minor annoyance.

[Using your phone, enable WiFi for 'inside' type testing; disable WiFi for 'outside' type testing].