Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I am trying to do something that should be rather simple, but still I can't make it work.

Let's say I have 2 virtual machines on my lan. Those machines are web servers for customer-testing purposes. The old one runs IIS6 and the new one runs IIS7.5

Let's say that I have only one public IP address to use. In the original scenario the public IP was mapped to the old machine, and all was fine.

Now I have the need to "split" this public address between those two machines. What I want to do is, based on the host header, "redirect" or "rewrite" the request to the correct machine.

So far I tried to use the "new" machine with IIS7 as a reverse proxy too, fiddling with ARR and Url Rewrite. I also tried the "Web Farm Framework" in combination with the previous two modules.

Short story: I can't make it work: all the requests are redirected to the "old" machine no matter what.

Long story: I tried to make things as clean as possible. My cleanest attempt was making 2 server farms, the first with the new machine (which is itself) and the second with the old machine.

In my rewrite rules, I put as first rule that anything that matches www1.*.mydomain.com should be routed to webfarm new, and stop processing.

The second rule (which should be checked only if the first one fails) says that anything that matches *.mydomain.com gets routed to webfarm old.

In this scenario, everything gets routed to the old machine. But if I disable the *.mydomain.com rule, the first one actually works. It's like the second rule takes priority if enabled, even if it's under the other one.

If anyone has a solution to this, even a total different approach, you're welcome. I need to split that public IP on those two machines based on host header.

Thanks.

share|improve this question
    
Using ARR should be the easiest/best way to do it, could you post the URL Rewrite rules that you used. It should be easy to get tha tworking. –  CarlosAg Jan 28 '11 at 22:08

2 Answers 2

You have not really stated which you want to do it, I guessing as to split content to several servers. I think Ngix would work for what your trying to do. It would help to know why you want to use 2 servers like so.

share|improve this answer
    
Tha's simple. The old server has a bunch of websites configured, and we don't want to move them to the new server. Also the old server has IIS6 while the new server has IIS7.5. We want to use the same public IP address for both of them, and redirect the request to the right machine based on host header. –  Matteo Mosca Jan 28 '11 at 15:53
    
Ok, Ngix you work well for you, you can set that up; have it bind to 80 the public IP or NAT and you can set it to forward requests to IIS exactly as you want. Also you get to drop the IIS rewrite stuff. –  Jacob Jan 28 '11 at 16:01

What you are wanting to do is referred to as a "reverse proxy" and there are many options. Most "load balancers" are reverse proxies with a few niceties.

Your options are pretty much as follows.

  • Setup a new server (Such as NginX or HAProxy)

    • NginX has the advantage of being a fairly straight forward setup, with some flexibility that is less well documented and harder to configure than IIS/ARR or HAProxy

    • HAProxy is probably the most robust solution I am listing, but also has the most configuration options

  • Setup Application Request Routing (ARR) and the URL Rewrite modules for IIS on the new server, and have each site with an ARR rule pointing to the internal site/server.

    • You will need to have a host entry, or separate IP binding for each site on the internal server.

    • You will need to have each site setup on the public server, or a complex ARR rule. I find that having each site with its' own "site" in IIS tends to be straight forward.

The gotchas in such a situation are as follows.

  • Your public proxy/iis instance will return an error html when it can't reach the internal server for whatever reason. (If you have say xml, or json services on the older server, you may want to migrate).

  • ARR on Server 2008, and 2008 R2 do not support forwarding WebSocket requests. I am unsure of 2012.


I know this is an older question, but wanted to do a more complete answer.

share|improve this answer

Your Answer

 
discard

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.