Can this be done by IIRF

Topics: User Forum
Sep 23, 2009 at 4:15 PM

Hello,

I am completly new in the world of url rewrite filters etc. But for my company I have to solve the following issue.

We have 2 webservers. The main webserver is a Windows 2003 with IIS 6. The second server is a Windows 2003 with Apache (WAMP) server.

On the main webserver we are hosting our Internet site, webmail, intranet site etc. On the second we want to host a Document management system and in a later stage other open source products. At this moment we can reach the second server by using port 81. So the url is http://www.mycompany.com:81/ . This works fine exept when trying to connect from some company's that do not allow traffic on port 81. What I would like to have is to redirect the traffic based on the url. So www.mycompany.com is handeld by the main webserver and www2.mycompany.com is handeld by the second webserver.

 

Can this be done by IIRF? If so where can i find some example config file? If not what options do have?

 

Greetings,

Frank

Coordinator
Sep 23, 2009 at 4:45 PM

I think what you want is not a redirect, but a reverse proxy. Sometimes called a "transparent proxy".

IIRF v2.0 has a ProxyPass directive that will allow you to "reverse proxy" requests to any other webserver.

An example of reverse proxy in action:  a browser sends a request, let's say for URL http://www2.domain.com/x.  The http server listening at domain.com maps this request, server-side, to a different, potentially external URL.  In this example, let's say it maps it to http://www.domain.com:81/x.   The webserver retrieves the content at that target URL, and passes it through to the listening client. To the client, a reverse proxy is "transparent" - it cannot tell that it is communicating with a proxy. 

Apache also has a mod_proxy that does the same thing, but is more mature and widely-used than the function in IIRF.

For IIS7 (included in Windows Server 2008), there is a Microsoft-provided proxy module. 

So you can use IIS+IIRF (with IIS 6 or below), or Apache, or IIS v7 or above, as a reverse proxy.  If you use Apache, you'll need to set it listening on port 80.  If you use IIRF or IIS alone, then you need IIS listening on port 80 (as you currently have it).

Consult the IIRF doc for an explanation of the ProxyPass directive and examples.

The rule in your case, I think, would be like this:

RewriteCond %{HTTP_HOST}   ^www2\.domain\.com$  [I]
ProxyPass ^/(.*)$          http://internal-server-name:81/$1

This exact example is included in the doc. Check it out to understand more.