Multiple web addresses Behind router.

Hello All.

I am using a hap AC2 as my main internet router, but my ISP gives me just a single IP address.

I have multiple computers (VM’s) hosting different things at home which i want to access from outside world.

Currently I am using nat port forwarding to port forward port 80 & 443 to a single web server which works fine.

so *.test.com:80 will go to 192.168.0.5:80

However what different domains/subdomains go to different VM’s?
How can i do that on mikrotic.

for example if server1.test.com:80 will go to 192.168.0.5:80
but server2.test.com:80 should go to 192.168.0.6:80


Currently I think i could do A) have a single Nginx vm proxy vm that does port forwarding inside the lan:

so *:80 > 192.168.0.4:80 (nginx transparent proxy) > seperate

Hey

firewall is ip based, not domain.

What you want to do is normally done on the webserver itself, as the requested domain is part of the request.

If you do run all server on Windows IIS or Linux Apache, they can both handle multiple Webservers based on DNS.

But If you have many Webservers on different system or on different ports, you can use a reverse proxy server like HAProxy.
Redirect 80(443) to the HAProxy server, then it can based on rules send these request to other server and ports.
HAProxy is free and can du much more, such as load balancing (multiple server handles request from same domain)
It can use different servers depending on path, so my-domain/folder1 goes to one server and my-domain/folder2 goes to another. ++++

I See,#

thanks for the guidance, So basically if i understand it correctly, The Mikrotik dst-nat firewall simply forwards WAN IP:port → a lan device : port that i set up in the firewall.

SO it’s down to my LAN devices (real or virtual) to route the packets internally and then back to the router to pass back?

Mikrotik will not do DNS/subdomain based routing on the router itself?