When I am on my local network (subnet?), I would like to go to sub1.myserver.com
and for it to work the same as going to 192.168.1.99:1234
- i.e. the goal would be to use the same domain name I also use publicly for this server while getting e.g. LAN download speeds.
My Setup:
I have multiple services running running on different ports, i.e.: 192.168.1.99:1234
and 192.168.1.99:5678
on my Debian Bookworm server.
My DNS (porkbun) has A
records for my public ip -> (sub)domain names.
And I have an nginx proxy doing proxy_pass
'es like sub1.myserver.com
-> 0.0.0.0:1234
and sub2.myserver.com
-> 0.0.0.0:5678
.
This works great and I can access my server publicly via sub1.myserver.com
.
I can also, of course, go to 192.168.1.99:1234
directly and connect to the same application via LAN.
How could I achieve re-using the same domain for local lan connections, and if not possible/not advisible, what would be the next best solution?