« Previous Next »

Thread: Reverse proxy via Server Farm

Last post 07-17-2009 5:46 AM by fanda. 4 replies.

Average Rating Rate It (5)

RSS

Page 1 of 1 (5 items)

Sort Posts:

  • 07-15-2009, 8:36 AM

    • fanda
    • Not Ranked
    • Joined on 07-15-2009, 5:56 AM
    • Posts 3

    Reverse proxy via Server Farm

    Hi all, I have two servers - internalserver (inside the intranet, not visible from outside) and externalserver (webserver published to the Internet as http://www.domain.com). There is a web mapping application running on the internalserver, so it is accessible only to the intranet users by entering something like http://internalserver/gis/maptest. What I need is to publish the application to the Internet via the externalserver so it can be accessed by http://www.domain.com/gis/maptest. As I understood this is possible by configuring reverse proxy for the externalserver. I've followed the instructions provided by the support of the web mapping application API on this site http://support.esri.com/index.cfm?fa=knowledgebase.techarticles.articleShow&d=35894 , but still can't make it work (in short, you create a server farm with one server - internalserver - and define URL Rewrite rule to redirect requests from external server to it). The application loads when I enter http://externalserver/gis/maptest, but not for http://www.domain.com/gis/maptest. What am I doing wrong? Thanks for any help... F.
  • 07-15-2009, 1:09 PM In reply to

    • himanshp
    • Top 150 Contributor
    • Joined on 01-05-2009, 5:36 PM
    • Redmond
    • Posts 37

    Re: Reverse proxy via Server Farm

    Hi Fanda,

    Can you please give more information - how your ARR as well as rewriter configuration look like when you are using ARR as reverse proxy?

    For information on how to use arr as reverse proxy you can use this blog. In your case since your host name is different in internal server, you can use rewriter to change host name when you are forwarding request to internal server from external server. Like below

     <rewrite>
        <globalRules>
          <rule name="Proxy" patternSyntax="Wildcard" stopProcessing="true">
            <match url="*" />
            <conditions>
              <add input="{HTTP_HOST}" pattern="www.domain.com" />
            </conditions>
            <action type="Rewrite" url="http://internalserver/{R:0}" />
          </rule>
        </globalRules>
    </rewrite>

    Some of the previous threads which might help you are ..

    1. http://forums.iis.net/t/1152682.aspx

    2. http://forums.iis.net/t/1155160.aspx

    3. http://forums.iis.net/t/1157619.aspx

    You can also achieve the same thing using server farm but I do not see any reason why reverse proxy doesn't work in your case.

    Let me know how it goes

    Thanks

    Himanshu

  • 07-16-2009, 6:01 AM In reply to

    • fanda
    • Not Ranked
    • Joined on 07-15-2009, 5:56 AM
    • Posts 3

    Re: Reverse proxy via Server Farm

    Hi Himanshu,

    thanks for your reply. My ARR and rewriter configuration looks like this:

    <webFarms>
        <webFarm name="AGS_MAGUL_ServerFarm" enabled="true">
            <server address="internalserver" enabled="true" />
        </webFarm>
        <applicationRequestRouting>
            <hostAffinityProviderList>
                <add name="Microsoft.Web.Arr.HostNameRoundRobin" />
                <add name="Microsoft.Web.Arr.HostNameMemory" />
            </hostAffinityProviderList>
        </applicationRequestRouting>
    </webFarms>

    <rewrite>
        <globalRules>
            <clear />
            <rule name="Proxy" enabled="true" patternSyntax="Wildcard" stopProcessing="true">
                <match url="gis*" />
                <conditions>
                </conditions>
                <action type="Rewrite" url="http://AGS_MAGUL_ServerFarm/{R:0}" />
            </rule>
    </globalRules>
    </rewrite>

    <proxy enabled="false" reverseRewriteHostInResponseHeaders="true" />

    Only http://externalserver/gis/maptest works, http://www.domain.com/gis/maptest doesn't. When I add the condition as you suggested:

    <rewrite>
        ...
                <conditions>
                    <add input="{HTTP_HOST}" pattern="www.domain.com" />
                </conditions>
        ...
    </rewrite>

    neither of the addresses works. I also tried to rewrite the url directly to internalserver instead of AGS_MAGUL_ServerFarm, but the result is the same.

  • 07-16-2009, 1:07 PM In reply to

    • himanshp
    • Top 150 Contributor
    • Joined on 01-05-2009, 5:36 PM
    • Redmond
    • Posts 37

    Re: Reverse proxy via Server Farm

    Hi Fanda,

    Can you configure your ARR server as server proxy? You do not need to create server farm in your case. The rule I have mentioned is to use it when ARR is configured as server proxy. I just tried out in my machine. I have tried configuring similar scenario, here is what I did...

    1 content server (intranet server) where I have website internalserver at port 80. My ARR machine is configured as server proxy, configuration looks as below

             <rewrite>
                <globalRules>
                    <rule name="ARR_server_proxy" enabled="true" patternSyntax="Wildcard" stopProcessing="true">
                        <match url="gis/*" />
                        <action type="Rewrite" url="http://internalserver/{R:0}" />
                        <conditions>
                            <add input="{HTTP_HOST}" pattern="www.domain.com" />
                        </conditions>
                    </rule>
                </globalRules>
            </rewrite>

            <proxy enabled="true" />
     

    What above rewriter rule will do is check if the url contian "gis/*" and host name is www.domain.com then only it will be forwarded to "internalserver". In ARR server I also edited my "%systemdrive%\windows\system32\drivers\etc\hosts" file to map "internalserver".

    Few things you ca verify is the site bindings in your internal server. what port is it running on? Also you do not need server farm(web farm) in your case. Can you try configuring as above and see if it works or not?

    If this still doesn't work can you please collect Freb log and send it to me.

    Thanks

    Himanshu

     

     

     

  • 07-17-2009, 5:46 AM In reply to

    • fanda
    • Not Ranked
    • Joined on 07-15-2009, 5:56 AM
    • Posts 3

    Re: Reverse proxy via Server Farm

    Hi Himanshu,

    I've tried your solution, but with no success. Still get the 404 error. The problem is the external server is the third party server, so I don't know exactly the configuration of the web site. I just got the access to configure the reverse proxy thing.

    But when I went through the applicationHost.config I found this section:

     <location path="www.domain.com">
       <system.webServer>
        <isapiFilters>
         <remove name="ASP.Net_2.0.50727.0" />
         <filter name="jakarta" path="C:\Program Files\Tomcat\bin\isapi_redirect\isapi_redirect.dll" />
        </isapiFilters>
        <asp appAllowClientDebug="true" appAllowDebugging="true" codePage="1250" enableParentPaths="true" lcid="1029" scriptErrorSentToBrowser="true" bufferingOn="false" />
       </system.webServer>
     </location>

    I'm not an expert on this, but could that be the problem? Does it somehow influence the redirection? I have not been aware of the Freb feature until you pointed it out, so I will try to trace the error on monday and send you the result.

    Thanks for your time...
    Fanda

Page 1 of 1 (5 items)
Microsoft Communities