Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a question about forwarding of the hostheader inside a network.

My setup is this: - On the front I have a Linksys router - Behind the router I have 3-4 test webservers with different setups - I'm in a windows environment

What I want do do, is having af sub-domain/CNAME following through the router to the different servers. Eg. I have "" and "" and I want website1 to forward to my testwebserver 1 and website2 to forward to my testwebserver 2.

In my current setup I can do it in the router, but I only handles ports, so the result is that all traffic on port 80, have to go to one server. This is a problem because then I can only exhibit one webserver at a time.

I would like if I could install some software on a windows-server that all traffic go thruogh so It's easy to setup new forwards.

Anybody have any input?

Regards Thomas

share|improve this question
up vote 1 down vote accepted

There is a third-party software for Windows (IIS), which - besides other things - does this job pretty well: ISAPI Rewrite.

ISAPI Rewrite is a powerful URL manipulation engine based on regular expressions. It acts mostly like Apache's mod_Rewrite, but is designed specifically for Microsoft's Internet Information Server (IIS). ISAPI Rewrite is an ISAPI filter written in pure C/C++ so it is extremely fast. ISAPI_Rewrite gives you the freedom to go beyond the standard URL schemes and develop your own scheme.

I used it for different purposes on our servers and it worked very well. Search for "Proxying". Here is the documentation for the RewriteProxy Rule.


You could use these rules

RewriteCond %{HTTP_HOST} ^$ 
RewriteProxy ^(.*) http://local-server-ip/appdir-for-domain/$1 [H,A,L]

RewriteCond %{HTTP_HOST} ^$ 
RewriteProxy ^(.*) http://local-server-ip/appdir-for-otherdomain/$1 [H,A,L]

or something like this:

RewriteCond %{HTTP_HOST} ^$ 
RewriteProxy ^(.*)$1 [H,A,L]

RewriteCond %{HTTP_HOST} ^$ 
RewriteProxy ^(.*)$1 [H,A,L]
share|improve this answer
Hi I have installed ISAPI Rewrite now, but must confess that the rewriting part looks a bit complex. Say I want the hostheader "" to forward to an IP: What do I have to write in my htaccess file? I'm no regEx expert atall - so hope you could help. – Thomas Jun 11 '09 at 8:43
One solution could be this (in the httpd.ini file): RewriteCond %{HTTP_HOST} ^$ RewriteProxy ^(.*) http: // local-server-ip/appdir-for-domain/$1 [H,A,L] I know, this means you'll have one web with a lot of apps... I'm trying to find a better solution. You could give internal pseudo headers and set the local DNS to the server, like '' and prxying to that internal name... – splattne Jun 11 '09 at 9:00
Hmm, I tried to copy the line you wrote but got back an error. I'm to green with the RegEx to configure the tool :-( Wish I could just maintain a list of "domain-strings" pointing to an internal IP-adress. Kind of like when you edit your Hosts-file, but just to forwarding traffic on port 80. – Thomas Jun 11 '09 at 11:56
It worked!! Thanks a lot!! – Thomas Jun 11 '09 at 13:41

Throw apache on there, use mod_proxy to forward to wherever and whatever you like.

share|improve this answer

If you want to stick with MS stuff then ISA Server can do this. It's an expensive solution, though you can sometimes find ISA on ebay for reasonable prices. Avoid ISA 2000, which is pants, and use either ISA 2004 or ISA 2006.

Alternatively any reverse proxy can do this. A cheap and reliable solution would be SQUID, though the config can seem unnecessarily tortuous to us Windows chaps. I've used SQUID and it works very well.


share|improve this answer
I like the thought of staying on the Windows platform a lot. Downloaded SQUID and unpacked. Looks like it is kind of complex to install and configure? Do I just set it up as default website in my IIS? – Thomas Jun 11 '09 at 11:58
SQUID listens on port 3128, so you'd need to configure inbound port 80 on your router to redirect to port 3128. Then you fiddle with the bloody complicated SQUID config file to configure the reverse relay. If you Google for "squid reverse proxy" or something similar you should find a howto. – John Rennie Jun 11 '09 at 17:15

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.