Domain Name ddns routing

I am trying to host a webpage on my home network, and just wanted to make sure I am on the right track.

My ISP, doesn't have static IP's, and they block port 80 inbound so its been especially difficult

My current setup uses no-ip to create a static address for my network i.e. abc.ddns.net points to a.b.c.d

I have a webserver hosted on and port forwarded to http://abc.ddns.net:100 and can access it externally, however I dont like remebering the ports and find it clunky to enter.

So I have been trying to find a way around this, my current thoughts are to have a subdomain site.ddns.net that routes to http://abc.ddns.net:100 but this physically changes the address bar which I would like to avoid No-Ip offers a domain masking feature which will redirect while keeping the domain name in the address bar, however this wont update so both abc.ddns.net:100/ and abc.ddns.net:100/page1 both display as site.ddns.net. This isnt the worst solution but its not ideal

Ive also done some experimenting with a proxy server running with Nginx, the problem here is port 80 is still blocked so traffic needs to be routed through port 81, also because I dont have a static ip, all traffic resolves to a.b.c.d:81 which ends up treating traffic from different subdomains as the same request

In any case, my setup has gotten to complicated. In short, I would like to have a domain name abc.ddns.net map to my.public.ip.address:port along with other subdomains site.ddns.net map to my.public.ip.address:port2, while on a non-static ip and port 80 + 443 blocked and while not having the browser revert the address to the actual port

EDIT: I have setup a proxy server outside my network, but i'm still having trouble to clarify for @user1686 the reason i say

also because I dont have a static ip, all traffic resolves to a.b.c.d:81 which ends up treating traffic from different subdomains as the same request

is because when setting up the blocking on nginx to look something like this

server {
    listen 80;
    server_name site.ddns.net;

    location / {
        proxy_pass http://abc.ddns.net:100;
        proxy_set_header site.ddns.net;
    }   
}

traffic doesn't forward from site.ddns.net instead sending you to the default nginx page

however if I add

server {
    listen 80;
    server_name upload-server.ddns.net;

    location / {
        proxy_pass http://llibyddap.ddns.net:100;
        proxy_set_header upload-server.ddns.net;
    }   
}

server {
    listen 80;
    server_name a.b.c.d

    location / {
        proxy_pass http://abc.ddns.net:100;
    }   
}

It correctly routes the traffic, I interpret this as no-ip physically changing the site.ddns.net into a.b.c.d before sending the request causing it to miss the server block. Although Im not entirely sure and am probably incorrect.

This issue means that the proxy server will route all subdomains to the same point.

EDIT 2: After letting changes propagate, and clearing my browsers cache, the external proxy server works exactly as I want it to. Thanks for everyone's help


Solution 1:

(For websites) DNS has no ability to map to specific ports, it needs to be 443 for HTTPS or 80 for HTTP, or the port needs to be specified in the URL.

Connecting your server or home network on a VPN which provides a static IP address may be the way to go, if its worth the small cost. (ie there are VPN providers designed to give you a static IP address on your device, rather then provide privacy services - just google VPN static IP and you will find plenty offerings)

The alternative is to run an off-site reverse proxy, but it is likely more complex and no cheaper then a VPN route.

Solution 2:

Ive also done some experimenting with a proxy server running with Nginx, the problem here is port 80 is still blocked so traffic needs to be routed through port 81

Then host the proxy elsewhere. That's your best option if you don't want the port to ever be added to the URL. Either the webserver itself, or a reverse proxy, has to be on port 80 (or 443 for HTTPS).

(It's not that DNS couldn't have mechanisms for that – indeed it has several record types that could point to a specific port – but that's something that the client has to deliberately look for in addition to the usual "address" record, and browsers don't use them for various reasons.)

also because I dont have a static ip, all traffic resolves to a.b.c.d:81 which ends up treating traffic from different subdomains as the same request

This doesn't make much sense – neither DNS nor reverse proxies work any differently if the IP address isn't static.

For the reverse proxy, you want to make sure the proxy software preserves the original "Host:" HTTP header (instead of adding one based on the proxy target). In Apache this is the "ProxyPreserveHost" option, in Nginx it may be something similar.

DNS never has any effect on the URL, regardless of how static or non-static the IP address is. If you visit a domain and actually see the URL in your address bar changing to something else (e.g. to an IP address), that's not done by DNS – it's done by the webserver explicitly issuing an HTTP-level redirect to the new URL. (Or sometimes an HTML redirect.)