We have here to web servers behind a router - one IIS and one Tomcat (on different machines / IP addresses). The domain is pointing to out external IP, which is forwarded to IIS (internal IP 192.168.1.10 for example). I'm trying to do the following: when [www.]ourdomain.com is entered the default web site on IIS have to be loaded (this part is ok), but when test.ourdomain.com is entered I want to redirect this request to another web server (192.168.1.11 for example). I created a site "test" on IIS and it is displayed when test.ourdomain.com is entered. Then I tried to redirect it with following rule:
Requested URL matches the pattern: * (using wildcards)
Condition: {HTTP_HOST} matches test.ourdomain.com
Action type: Rewrite
Rewrite URL: http://192.168.1.11/{R:0}
but when I try to load test.ourdomain.com now I get IIS's error 404 page.
Obviously I'm wrong :-)
How can I do such a redirect?
Answer
A rewrite needs to be a relative path on disk, under the same website. That's what is causing the 404 error in your case.
A redirect will send a client-side redirect, but that won't work since 192.168.1.11 is an internal IP that can't be accessed publicly.
What you need is ARR: http://www.iis.net/expand/ApplicationRequestRouting. It's a reverse proxy and will take the public request and forward it on to the internal server. This is the middle man between the client and the internal server. It leverages IIS and URL Rewrite so you're already much of the way there.
Comments
Post a Comment