Homepage - Serve different page based on users IP. reddit / selfhosted ---------------------------------------------------------------------- TroleMaster2013 · 2023-12-18 20:00 Hi, I just set up a my unraid server homepage. Have it as a media server with jellyfin, jellyseerr, radarr, sonarr etc. I have a public domain that points to this machine via a caddy reverse proxy. The issue is sometimes the public links don't work when I am in the same network. Right now my homepage is set to server all the public links to my services, but is there any way to have it serve the local ip to the services based on the user's ip? - Or if there is a better way to resolve the public domain to my local ip so I can easily use one link instead of change based on where I am hitting it from. ---------------------------------------------------------------------- MaxGhost · 2023-12-18 20:56 You can use the https://caddyserver.com/docs/caddyfile/matchers#remote-ip matcher to do routing. But really, the correct thing to do is set up a DNS server in your LAN which overrides the IP address for the domains to point to your local IPs instead. The reason it doesn't work is probably because your router doesn't support NAT hairpinning, i.e. your router doesn't know how to route requests to your WAN IP back into your network. Most consumer routers don't support this. I don't understand why though, it's a simple feature. ---------------------------------------------------------------------- murdaBot · 2023-12-19 11:25 You could easily do this with a traditional nginx web server or reverse proxy too. ---------------------------------------------------------------------- MaxGhost · 2023-12-19 14:46 Sure, but they said they're using Caddy. ---------------------------------------------------------------------- ZAFJB · 2023-12-19 15:49 DNS, it's always DNS Configure an A record with the local IP of the webserver in your local DNS server. If you don't have a local DNS server, configure an entry in your hosts file. ---------------------------------------------------------------------- TroleMaster2013 · 2023-12-19 19:58 Yeah I set this up, but since I have basic authentication on my public site, in theory would setting up my DNS to match to my local IP make it so I by bypass what my reverse proxy has set for the public domain? For example Local Address: 192.168.0.25:8096 (DNS record for stream.home.) Public Domain: https://stream.mydomain.com Reverse Proxy: set to point https://stream.mydomain.com to 192.168.0.25:8096 with basic_auth set. DNS Record for stream.mydomain.com to 192.168.0.25. I guess I have to look at Caddy, cause regardless of what the DNS does, anything that comes to the caddy config will hit the right port, but would go through the authentication as well.