Let's say you have your 2 servers, Server A and Server B with IP_A, IP_B respectively.
The HTTP/HTTPS requests come through ports and using a basic router only ports can be forwarded to each of your 2 local server IPs.
You can use 1 of your 2 servers to act as a proxy to the other server.
Firstly forward port 80 & 443 to the server A using its ip IPA.
Let the server with ip IPA, channel the requests to the other server(s) based on the requested URL.
Depending on what Server Software you use you need to follow different approaches.
In apache for port 80 you will need to edit your configuration file:
sudo gedit /etc/apache2/sites-available/000-default.conf
Add the lines at the end of <VirtualHost *.80>
<VirtualHost *.80>
....
RewriteRule ^/games/?(.*)$ http://{IPB}/games/$1 [P,L]
ProxyPassReverse /games http://{IPB}/games
RewriteRule ^/blogs/?(.*)$ http://{IPB}/blogs/$1 [P,L]
ProxyPassReverse /blogs http://{IPB}/blogs
</VirtualHost>
In each case, we added the ProxyPassReverse
directive to ensure that any redirects issued by the backend are correctly passed on to the client.
/blogs
isn't an actual sub directory on the server and is just a route in the web application?