« Previous Next »

Thread: Recipe for proxying http requests to different port on same machine

Last post 03-03-2009 5:26 PM by Skwerl. 2 replies.

Average Rating Rate It (5)

RSS

Page 1 of 1 (3 items)

Sort Posts:

  • 03-02-2009, 11:44 PM

    • Skwerl
    • Not Ranked
    • Joined on 02-11-2009, 10:00 PM
    • Posts 3

    Recipe for proxying http requests to different port on same machine

    I apologize if this is an elementary situation, but I've been banging my head on it for a couple hours without success.  This has been mentioned on the forum before, but I don't see explicit directions on how to accomplish this.  We have a mail server with its own web server (for webmail) running on the same machine we use IIS7 on to serve our web sites.  I've set the webmail server to use port 81.  What I would like is to proxy external requests for mail.domain.com to localhost:81.  I had no problem getting redirection to work, but due to firewall limitations, we want everything to go through port 80, so this wasn't suitable.
      I've added the following server level (I trashed the "fake" webfarm I set up) rewrite rule:

    <rule name="ProxyWebMail" patternSyntax="Wildcard">
                        <match url="*" />
                        <conditions>
                            <add input="{HTTP_HOST}" pattern="mail.domain.com" />
                        </conditions>
                        <action type="Rewrite" url="http://mail.domain.com:81/{R:0}" />
                    </rule>

    The result of this is a 404.4 error.  I don't know why IIS is complaining about a handler.  Is it trying to process the php file that the webamail server is using?  If anyone can provide me with some detailed guidance on how to accomplish this, I'd be most appreciative.  Perhaps providing a comprehensive list of "recipes" like this as they are encountered and solved in the forum would be helpful in the ARR documentation pages.

    Thank you in advance,
    Josh Usovsky

  • 03-03-2009, 1:10 AM In reply to

    • anilr
    • Top 10 Contributor
    • Joined on 05-23-2006, 10:13 PM
    • Redmond, WA
    • Posts 2,343

    Re: Recipe for proxying http requests to different port on same machine

    You just need to turn on reverse proxying in ARR

    %windir%\system32\inetsrv\appcmd.exe set config -section:system.webServer/proxy -enabled:true

    Anil Ruia
    Senior Software Design Engineer
    IIS Core Server
  • 03-03-2009, 5:26 PM In reply to

    • Skwerl
    • Not Ranked
    • Joined on 02-11-2009, 10:00 PM
    • Posts 3

    Re: Recipe for proxying http requests to different port on same machine

    Thank you, Anil.  I ran that command and then restarted IIS, but it still did not work.  After another hour of messing witht he rewrite rule, it suddenly started working.  My rule looks no different now than it did when I started, but now it's working!  :)

     Thanks,
    Josh Usovsky

Page 1 of 1 (3 items)
Microsoft Communities