Subdirectory on different servers but same sub domain

I have a subdomain e.g.

https://xyz.example.com

In IIS I have a subdirectory under this domain on one server:

https://xyz.example.com/site1

I want to point the subdomain to another ip address on another server e.g.

https://xyx.example.com/site2

So basically I have two sites using the same subdomain but on different server. Is this possible and if so how do you configure it?


Solution 1:

This is not directly possible. The destination server is defined by the subdomain, not the subdirectory.

A workaround might be to put a reverse proxy server in front of the two servers. This proxy servers can internally dispatch requests to another web server depending on the subdirectory. This can work because the subdomain points to the reverse proxy which dispatches the requests.