Rewrite to webserver running on a certain port

Topics: User Forum
Apr 29, 2009 at 5:25 PM
Edited Apr 29, 2009 at 5:30 PM
I have a website setup for the redirect: example.company.com on host serverx
I want to rewrite any requests for example.company.com to a web app running on serverx:####
I'm running IIS6. The web app is running a built-in web engine, not IIS.

I have configured what I think should work, but it's not working:
RewriteRule  ^/(.*)$  http://serverx:####/$1

I'm getting 404 errors when I try http://example.company.com/
But I am able to get to the website using http://serverx:####/

I'm assuming I have the rule set up incorrectly. A little help would be greatly appreciated.

TIA.
Apr 29, 2009 at 6:22 PM

I've been doing what I can, and here's where I am so far

I've update the INI file to:

RewriteLogLevel 4
RewriteLog c:\temp\IIRFLog
RewriteCond %{HTTP_HOST} ^example.company.com$
RewriteRule ^/(.*)$ http://serverx:####$1

According to the log file, it's rewriting the URL correctly. 'http://example.company.com/' becomes 'http://serverx:####/'

But for some reason, I keep getting the 404 errors. Why?

Coordinator
May 1, 2009 at 8:14 AM
Edited May 1, 2009 at 8:15 AM
I think you want a REDIRECT, not a REWRITE.
But your rule is for a Rewrite.

To get Redirect, you need to use the [R] flag, or, use RedirectRule, if that is supported by the version of IIRF you're using.

Check the readme - read up on the difference between Redirect and Rewrite.
May 1, 2009 at 12:32 PM
From what I understand, a REDIRECT will change the URL in the client browser. The whole purpose of implementing this was to mask the port number. Since the web app doesn't run on IIS, we couldn't use the traditional IIS methods. That why I wanted to use IIRF to rewrite any requests for 'http://example.company.com/' to 'http://serverx:####/'.
Coordinator
Jul 6, 2009 at 7:09 PM

Ahh, then what you want is a PROXY , and IIRF is not that. Check the readme for more info.