I have some subdomains that go to my home address (I know I should put it through a VPS first but I’ll get to that when I have time).

If I connect to example.domain.tld and DNS records point back to my own IP, where does that data go to reach back to my device?

Edit: thanks for the responses everyone

  • yaroto98@lemmy.world
    link
    fedilink
    English
    arrow-up
    5
    ·
    1 month ago

    Depends, you can set it up a few different ways.

    1. you can set the dns so each subdomain resolves to a different port with your ip, in which case your router can forward that port to any local address on your network with port forwarding rules.

    2. reverse proxy, this is most common. You use a service to do the translating for you. Your router forwards all requests on port 80 and 443 to your reverse proxy. The reverse proxy takes requests for subdomain1 and forwards it to the associated ip/port locally.

    • jws_shadotak@sh.itjust.worksOP
      link
      fedilink
      English
      arrow-up
      2
      ·
      1 month ago

      I have a reverse proxy set up already. The path from the outside goes:

      DNS -> my IP -> reverse proxy -> server

      I’m just wondering what happens when my own devices on the same network go to the domain.

    • 4am@lemmy.zip
      link
      fedilink
      English
      arrow-up
      1
      ·
      1 month ago

      Can you set a port on DNS services that don’t typically use an SRV record (like Minecraft does, for example)?

      I think I tired to figure this out once but couldn’t get it to work with web browsers. Ended up just looking at the HTTP request to find the subdomain and then routed from a reverse proxy as appropriate…

  • Redjard@reddthat.com
    link
    fedilink
    English
    arrow-up
    1
    ·
    1 month ago

    With IPv4, assuming you have a residential contract without cgnat, your router has your ip. Loosely your device calls your public ip, realizes it is not on your local network, and sends it to your router. The router will nat it, and send it to its own internet-facing networking side, where the same router will realize that the target ip is the ip of it’s own interface and will immediately accept it. Then it is handled like any other packet arriving from the internet, presumably port forwarded to some internal machine.

    So we expect one hop to the router, then one internal hop from the private to the internet-facing interface of the router, and then presumably another internal hop back to the private network interface and another proper hop to the server on your lan.

  • This is something you can easily do from the command terminal. For Windows, use Tracert. Linux and Mac, maybe even iPhone and Android have their own commands to run a trace route, too (I don’t know them off the top of my head).