0

I'm struggling to forward subdomains from WAN to particular services on my LAN. Most services are running on a NAS with a static LAN IP address. Some of the services are Docker containers, some are native in the NAS, each has its own port and already works fine on the LAN through that port.

What I want:

What I have:

  • Static IP: My ISP guarantees static IPv4 + IPv6 addresses, so I know that the IP is correct.
  • Domain: The DNS listing is managed with my web hosting provider where it is pointing to the static IP of my home DSL connection. I understand this to be a "wildcard" domain, so no configuration is necessary (nor even possible) for individual subdomains.
  • DSL modem: This has the static WAN IP and is configured to be "wide open" because my gateway is the only LAN device. No wifi.
  • Gateway: UniFi USG with a web interface; it sees the DSL modem on the WAN side and my home network on the LAN side. I can forward desired external ports to desired LAN IP addresses + ports:
    from WAN IP * port 80,443 to LAN IP 192.168.1.11 port 80,443.
  • Server: Synology NAS with static LAN IP and built-in reverse-proxy functionality, e.g. http://bin.example.com --> http://192.168.1.11:7777
    and for each service, I can specify WAN protocol+hostname+port, enable HSTS, enable HTTP/2, and internal protocol+hostname+port.
    enter image description here
  • Services: e.g. running a Docker container in bridge mode (lives on the host's IP address) with a published HTTP port 7777 toward its internal container port 80. Thus, http://192.168.1.11:7777 is a service I can access from a LAN computer.
  • Pi-hole: A Raspberry Pi running Pi-hole. The gateway has this configured, and LAN devices are auto-dhcp (except the NAS with static IP).

Preliminary results:

  • LAN computers can access the service equally well on http://example.com:7777/ and http://192.168.1.11:7777/ but not on http://bin.example.com/ and get the error DNS_PROBE_FINISHED_NXDOMAIN.
  • WAN device (my smartphone with WiFi off) can not access the service on any of those addresses and get the error DNS_PROBE_BAD_CONFIG.
  • WAN device can access the NAS's built-in services like the website at http://example.com//https://example.com/ (standard ports 80 and 443).
3
  • Provided that you are only passing HTTP/HTTPS traffic through it, you can probably do as you suggest, by registering the domain names you need (and specifying the subdomains within them) and pointing them to your WAN IP. from there, forward 80/443 to your NAS. it will be up to the NAS to determine which backend to proxy the traffic to, but if its all HTTP, the requests will include the target host, so the NAS should be able to tell which service goes where. Also, note that for most home routers, you can't test port forwarding from within the LAN. you need hairpin NAT. Commented Nov 15, 2021 at 22:36
  • everything points to issues with your DNS configuration for your domain registration. are you sure you don;t need to configure subdomains? Commented Nov 15, 2021 at 22:43
  • "need to configure subdomains?" Spot on! I thought this was not necessary with my domain, but I added a subdomain on the hosting provider's control panel, and as soon as DNS was propagated to my region, that subdomain got a response from my server. Thank you! Commented Nov 16, 2021 at 10:29

1 Answer 1

0

It sounds like you don't have anything doing the reverse proxying.

Reverse proxying is normally done by webserver software. Many advanced webservers (nginx, Caddy, Apache) will let you setup virtual hosts that do nothing but forward traffic to something behind it, and allow you to specify a port for the destination.

nginx has caching capabilities and a reputation for being very fast so it's often used for this purpose.

So you could install nginx and configure it, creating a virtual host for each of your services.

nginx will take some time to really learn but it's very powerful.

1
  • The NAS does have a built-in reverse proxy. I added a screenshot to my post. Commented Nov 15, 2021 at 20:42

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .