IIS 6 – Create a virtual directory that points to an IIS application on a different server

iis-6

Here's the scenario:
Server A is hosting the 'main' application (www.example.com)
Server B is hosting a support application (b.example.com)
They are connected internally to each other through a 192.* address and are both externally available through DNS

Server A has several virtual directories that are mapped through UNC shares:
www.example.com/virtual1 -> \192.168.1.1\virtual1 (on serverB)

I'd like to be able to run the application that sits on Server B (served through IIS) and make it appear as if it's running on serverA:

www.example.com/application -> b.example.com/app

I'd still want to be able to access server B directly

b.example.com/app

Any ideas?

Edit:


Turns out the application behind the proxy refused to let me dynamically change it's form "action" (nor did it let me change anything else). I was able to display the data from the server; just couldn't post 🙁

So both answers pointed me in the right direction. I used a proxy:

http://code.google.com/p/iisproxy/

I created a virtual directory on Server A that matched the directories I needed on Server B – and it worked! 🙂

Best Answer

This should be possible in IIS. I remember I had to do this once.

Just create a virtual directory using the UNC path pointing to \\ServerB\SharedAppDirOnB and (if necessary) "Connect As..." using the credentials needed for Server B.

If you have problems with "Connect As..." it could be a folder permissions problem of Server B. Try the following thing: add a new user account on your main server which has the same name and password as the account on Server B. It sounds stupid, but I remember it solved my issue. You could for example add a new user account on both servers: "IisCommon" with the same passwords on both servers. Then make sure you give all necessary file access permission to the folder on server B (and the Share permission!). Try first connecting manually using Windows Explorer if you can access the share.

Make sure that you mark the new virtual directory as application and give the right execution permissions.


Another solution would be some kind of reverse proxy. I used a third-party product on IIS 6.0 for this: ISAPIrewrite for IIS. The "proxy" mode allows you to "forward" request made to your main server (www.example.com/...) to your other server, but serving the resulting responses as if they were processed by your main "domain" application. The feature is called "proxy directive". It accepts regular expressions.

Related Topic