this post was submitted on 23 Jun 2024
51 points (98.1% liked)

Selfhosted

40296 readers
311 users here now

A place to share alternatives to popular online services that can be self-hosted without giving up privacy or locking you into a service you don't control.

Rules:

  1. Be civil: we're here to support and learn from one another. Insults won't be tolerated. Flame wars are frowned upon.

  2. No spam posting.

  3. Posts have to be centered around self-hosting. There are other communities for discussing hardware or home computing. If it's not obvious why your post topic revolves around selfhosting, please include details to make it clear.

  4. Don't duplicate the full text of your blog or github here. Just post the link for folks to click.

  5. Submission headline should match the article title (don’t cherry-pick information from the title to fit your agenda).

  6. No trolling.

Resources:

Any issues on the community? Report it using the report flag.

Questions? DM the mods!

founded 1 year ago
MODERATORS
 

So maybe I am missing something obvious, but here goes:

I've got a small server at home, and I have simply.com pointing various domains to it. Works fine, nginx routs the traffic where it needs to go.

But whenever I am at home and connected to wifi I have to use the internal address and port to reach my server, e.g. 192.168.0.192:8096 for my Jellyfin server. If I use the public URL at home, i hit the login page to my router.

This is annoying when I use apps, as I need to switch between the public URL and the internal address as I come and go from my home...

What are my options for doing something about this? I want to use the public URL at home too....

top 21 comments
sorted by: hot top controversial new old
[–] slazer2au@lemmy.world 24 points 5 months ago (1 children)

You may have to set up split zone DNS so names resolve to private IPs when at home but resolve to public addresses when not home.

[–] mhzawadi@lemmy.horwood.cloud 16 points 5 months ago (1 children)

I use pihole as my home DNS to do that

[–] azron@lemmy.ml 5 points 5 months ago

This is what I do as well. I use terraform/tofu and add two entries whenever I add a new domain, one for my external provider and one for my pihole pointing at my internal IP for my home network.

[–] CameronDev@programming.dev 17 points 5 months ago* (last edited 5 months ago) (3 children)

I can't remember exactly what its called, but something like ~~router~~ NAT loopback is what you want. I'll have a look around. But if you set it right, things should work properly. It might be a router setting.

Found it: https://community.tp-link.com/en/home/stories/detail/1726

[–] EvilCartyen@feddit.dk 14 points 5 months ago* (last edited 5 months ago) (1 children)

Thanks - I have an icotera i4850 router which claims to support NAT loopback, but I can't figure out where to do it and it seems like the manual is gone from the internet :) Might have to ask my internet provider if they have a PDF somewhere.

Edit: D'oh, it's a checkbox in the port forwarding interface! Thanks a bunch, didn't know what to look for before your reply :)

[–] danielquinn@lemmy.ca 8 points 5 months ago

Thanks for posting this! I have the same router.

[–] Creat@discuss.tchncs.de 11 points 5 months ago

Another name, depending on the exact context, is "hairpin NAT". Should make googling with the specific router OP has easier.

[–] poVoq@slrpnk.net 4 points 5 months ago (1 children)

I think the term often used is "NAT reflection".

[–] CameronDev@programming.dev 3 points 5 months ago

Never heard that term, but its a very obscure concept, so wouldn't surprise me if it had multiple names. Probably vender specific names?

Seems quite a few people havent heard of it, hence a lot of the split DNS answers :/

[–] Knossos@lemmy.world 15 points 5 months ago (1 children)

On my Fritzbox, I needed to add all my Subdomains to a list under:

DNS Rebind Protection Your FRITZ!Box suppresses DNS responses that refer to IP addresses in its own home network (DNS rebind protection). Here you can specify exceptions for which DNS rebind protection should not apply. Do this by entering the complete name of the host (domain name including the subdomain) in the list.

That's under network settings, advanced. In case you have that.

Indeed it is DNS rebind protection.

I use wildcard on my Fritzbox. I added *.mydomain.com and my MyFritz address *.er467.myfritz.net

Important for everyone who makes changes on DNS rebind protection: You will need to completely RESTART your Fritzbox. Even if you add a line, or edit. One domain per line. It will not work without it ☝🏻

[–] Decronym@lemmy.decronym.xyz 4 points 5 months ago* (last edited 5 months ago)

Acronyms, initialisms, abbreviations, contractions, and other phrases which expand to something larger, that I've seen in this thread:

Fewer Letters More Letters
DNS Domain Name Service/System
IP Internet Protocol
NAT Network Address Translation

3 acronyms in this thread; the most compressed thread commented on today has 15 acronyms.

[Thread #825 for this sub, first seen 23rd Jun 2024, 06:25] [FAQ] [Full list] [Contact] [Source code]

[–] powermaker450@discuss.tchncs.de 4 points 5 months ago

usually in your router settings you can change local DNS settings. you can set your domains and subdomains to point to your server's local IP.

[–] peregus@lemmy.world 3 points 5 months ago

To bypass this problem you can add your domain (with all the third level ones) to your router, pointing to your internal IP

[–] sandalbucket@lemmy.world 3 points 5 months ago (1 children)

I strongly recommend the NAT loopback route over attempting split-horizon dns.

[–] EvilCartyen@feddit.dk 1 points 5 months ago (1 children)

I did go for that 😁 was a simple checkbox in the router settings.

[–] aaravchen@lemmy.zip 1 points 5 months ago

FYI, this is called "split horizon" DNS, where the location you get directed is based on the network you adk from. Make sure you have short TTLs set on your DNS records, or devices can have problems moving between networks and still having records cached from the prior network

[–] g_damian@lemmy.world 3 points 5 months ago

It depends if your reverse proxy is inside your home network or outside. It should work without any other configuration if you forward ports 80&443 from external domain with something similar to rathole and configure reverse proxy inside home network.

This is not an answer to your question about using the same url, but see this article, it might be helpful. Tl;dr: mdns + reverse proxy.

[–] raf802@lemmy.world 2 points 5 months ago

Based on my setup, I use adguard to DNS rewrite all *.example.com domains to the IP of my Nginx proxy. I have the proxys setup on NPM. On my router I have adguard set as the home network DNS. Cloudflare is used as the external DNS so that the *.example.com domains work outside of my network (and point to thr Nginx server).

My setup is relatively basic, unraid dockers etc.

[–] cmnybo@discuss.tchncs.de 1 points 5 months ago

If your ISP provides IPv6, set that up. Everything will have a globally routed address, so your domains will work from your LAN and the internet. If you don't have IPv6 available, get a free tunnel from Hurricane Electric.

[–] jet@hackertalks.com 0 points 5 months ago

Ipv6

Depending on your gateway, you may be able to override the DNS settings for a few domains that you use internally