IIS reverse proxy page is not openingRSS

5 replies

Last post May 29, 2020 09:29 AM by Yuk Ding

‹ Previous Thread|Next Thread ›
  • IIS reverse proxy page is not opening

    May 15, 2020 02:17 PM|rktjp|LINK

    Hi,

    I have configured IIS reverse proxy to access our internal web server.

    I want requests using browser the page at http://jaypeeit.co.in:8080/JAL-SAPIT-SVR/mail/admin.nsf?OpenDatabase, and the request is proxied/routed to http://172.16.4.178/mail/admin.nsf?OpenDatabase on the server-side

    Its getting redirected correctly to server and hitting home page of web server.

    But its getting stuck after that not opening other pages.

    configuration is given below. pls suggest where i have done mistake.

    <?xml version="1.0" encoding="UTF-8"?>
    <configuration>
    <system.webServer>
    <rewrite>
    <rules>
    <rule name="Route the requests for JAL-SAPIT-SVR" stopProcessing="true">
    <match url="^JAL-SAPIT-SVR/(.*)" />
    <conditions>
    <add input="{CACHE_URL}" pattern="^(https?)://" />
    </conditions>
    <action type="Rewrite" url="{C:1}://172.16.4.178/{R:1}" />
    <serverVariables>
    <set name="HTTP_ACCEPT_ENCODING" value="" />
    </serverVariables>
    </rule>
    </rules>
    <outboundRules>
    <rule name="ReverseProxyOutboundRule1" preCondition="ResponseIsHtml1">
    <match filterByTags="A, Area, Base, Form, Frame, Head, IFrame, Img, Input, Link, Script" pattern="^http(s)?://172.16.4.178/(.*)" />
    <action type="Rewrite" value="/JAL-SAPIT-SVR/{R:2}" />
    </rule>
    <rule name="RewriteRelativePaths" preCondition="ResponseIsHtml1">
    <match filterByTags="A, Area, Base, Form, Frame, Head, IFrame, Img, Input, Link, Script" pattern="^/(.*)" negate="false" />
    <action type="Rewrite" value="/JAL-SAPIT-SVR/{R:1}" />
    </rule>
    <preConditions>
    <remove name="ResponseIsHtml1" />
    <preCondition name="ResponseIsHtml1">
    <add input="{RESPONSE_CONTENT_TYPE}" pattern="^text/html" />
    </preCondition>
    </preConditions>
    </outboundRules>
    </rewrite>
    </system.webServer>
    </configuration>

  • Re: IIS reverse proxy page is not opening

    May 18, 2020 07:06 AM|Yuk Ding|LINK

    Hi rktjp,

    If the page across reverse proxy is not opening, There must be some exceptions. So please enable F12 developer tool and access the broken page to reproduce this issue. What error message will you see in console panel? Besides, did you see any failed request with  404 or 500?

    Best Regards,

    Jokies Ding

    Yuk Ding

    MSDN Community Support
    Please remember to "Mark as Answer" the responses that resolved your issue.
  • Re: IIS reverse proxy page is not opening

    May 19, 2020 10:45 AM|rktjp|LINK

    Hi Yuk, Thanks for your reply !

    I am explaining my scenario in brief.

     

    1. 1. Web Server : www.jaypeeit.co.in
    2. 2. IS reverse proxy server : www.jaypeeit.co.in:8080
    3. 3. Local/Internal Server : 172.16.4.178, 172.16.4.67

     

    My web server is creating URL in the form below 

     

    1. http://www.jaypeeit.co.in:8080/JAL-SAPIT-SVR/mail/admin.nsf?OpenDatabase
    2. http://www.jaypeeit.co.in:8080/JAL-MAST-SVR/mail/admin.nsf?OpenDatabase

    Now we want redirect request as

                    JAL-SAPIT-SVR --> 172.16.4.178

                    JAL-MAST-SVR--->172.16.4.67

     

    Now I have setup the redirection for one server (JAL-SAPIT-SVR). When accessing it by putting URL (http://www.jaypeeit.co.in:8080/JAL-SAPIT-SVR/mail/admin.nsf?OpenDatabase) directly on browser .It’s working fine.

    But when we are accessing it our web server (www.jaypeeit.co.in), it’s not working .Page getting failed. I have checked browser and URL conversion by web server is done rightly at browser end.

    Web.config is as follows. 

     

    <?xml version="1.0" encoding="UTF-8"?>
    <configuration>
      <system.web>
        <httpRuntime requestPathInvalidCharacters="" requestValidationMode="2.0" />
      </system.web>
      <system.webServer>
        <rewrite>
          <rules>
            <clear />
            <rule name="ReverseProxyInboundRule for JAL-SAPIT-SVR" enabled="true" stopProcessing="true">
              <match url="^JAL-SAPIT-SVR/(.*)" />
               <action type="Rewrite" url="http://172.16.4.178:80/{R:1}" />
              <serverVariables>
                            <set name="HTTP_X_ORIGINAL_ACCEPT_ENCODING" value="{HTTP_ACCEPT_ENCODING}" />
                            <set name="HTTP_ACCEPT_ENCODING" value="" />
              </serverVariables>
            </rule>
          </rules>
          <outboundRules>
            <rule name="RestoreAcceptEncoding for JAL-SAPIT-SVR" preCondition="NeedsRestoringAcceptEncoding" enabled="true">
              <match serverVariable="HTTP_ACCEPT_ENCODING" pattern="^(.*)" />
               <action type="Rewrite" value="{HTTP_X_ORIGINAL_ACCEPT_ENCODING}" />
            </rule>
            <rule name="ReverseProxyOutboundRule for JAL-SAPIT-SVR" preCondition="ResponseIsHtml1">
              <match filterByTags="A, Form, Img" pattern="^http(s)?://172.16.4.178:80/JAL-SAPIT-SVR/(.*)" />
              <action type="Rewrite" value="{R:2}" />
            </rule>
                        <rule name="RewriteRelativePaths for JAL-SAPIT-SVR" preCondition="ResponseIsHtml1" enabled="true">
                        <match filterByTags="A, Area, Base, Form, Frame, Head, IFrame, Img, Input, Link, Script" pattern="^/(.*)" negate="false" />
                    <action type="Rewrite" value="{R:1}" />
                    </rule>
            <preConditions>
                                  <remove name="ResponseIsHtml1" />
              <preCondition name="ResponseIsHtml1">
                <add input="{RESPONSE_CONTENT_TYPE}" pattern="^text/html" />
              </preCondition>
              <preCondition name="NeedsRestoringAcceptEncoding">
                <add input="{HTTP_X_ORIGINAL_ACCEPT_ENCODING}" pattern=".+" />
              </preCondition>   
            </preConditions>
          </outboundRules>
        </rewrite>
        <urlCompression doStaticCompression="false" doDynamicCompression="false" />
            <tracing>
                <traceFailedRequests>
                    <add path="*">
                        <traceAreas>
                            <add provider="ASP" verbosity="Verbose" />
                           <add provider="ISAPI Extension" verbosity="Verbose" />
                            <add provider="WWW Server" areas="Authentication,Security,Filter,StaticFile,CGI,Compression,Cache,RequestNotifications,Module,FastCGI" verbosity="Verbose" />
                        </traceAreas>
                        <failureDefinitions statusCodes="100-999" />
                   </add>
                </traceFailedRequests>
            </tracing>
    
      </system.webServer>
    
    </configuration>

     

    I have checked failed request report and getting error as

     

    No.↓

       

    Severity   

    Event   

    Module Name   

    53.

    view trace

    Warning

    -MODULE_SET_RESPONSE_ERROR_STATUS 

    ModuleName

    ApplicationRequestRouting

    Notification

    128

    HttpStatus

    404

    HttpReason

    Not Found

    HttpSubStatus

    0

    ErrorCode

    0

    ConfigExceptionInfo

    Notification

    EXECUTE_REQUEST_HANDLER

    ErrorCode

    The operation completed successfully. (0x0)

    I will be thankful ,please suggest where I am doing mistakes.

  • Re: IIS reverse proxy page is not opening

    May 21, 2020 10:05 AM|Yuk Ding|LINK

    Hi rktjp,

    404 just looks like the application is requesting the wrong place.  I think if you need to set outbound rule for the proxy server. Then           <match filterByTags="A, Form, Img" pattern=" " /> should point to your front-end server www.jaypeeit.co.in instead of backend server 72.16.4.178.

    Best Regards,

    Jokies Ding

    Yuk Ding

    MSDN Community Support
    Please remember to "Mark as Answer" the responses that resolved your issue.
  • Re: IIS reverse proxy page is not opening

    May 26, 2020 11:08 AM|rktjp|LINK

    Hi Yuk

    Thanks for your attention to my help!!

    I have searched some document, which is about apache reverse proxy for same redirection. As per it

    "The solution is to catch the URL returned by the database as response to the first user request, that contains the web server common name and let the reverse proxy save the information in a cookie. This cookie will then be used by the Reverse Proxy for URLs that do not contain the server name to build the URL correctly"

    But I am clueless.Please suggest to achieve same on IIS reverse proxy.

    I am attaching rule here for your kind reference, created in apache reverse proxy server.

    # Rule 0 : If Cookie is set and user logs out, remove the cookie
    
    RewriteCond %{HTTP_COOKIE} ^.*iNotesServer=.* 
    RewriteCond %{QUERY_STRING} ^Logout
    RewriteRule ^/.* - [CO=iNotesServer:domino1:.acme.com:1]
    
    # Rule 1 : Read domino server name from first access to the mail directory,
    # save it to the cookie and redirect to the mail server 
    RewriteCond %{REQUEST_URI} ^/(.*)/mail
    RewriteRule /(.*)/mail/(.*) http://$1.acme.com/mail/$2 [P,CO=iNotesServer:$1:.acme.com]
    
    # Rule 2 : If cookie is set, use it to rewrite rules for iNotes generated URLs
    # and non mail DBs for the server definde in the cookie iNotesServer 
    RewriteCond %{REQUEST_URI} ^/favicon.ico [OR]
    RewriteCond %{REQUEST_URI} ^/domjs [OR] 
    RewriteCond %{REQUEST_URI} ^/domjava [OR] 
    RewriteCond %{REQUEST_URI} ^/domcfg.nsf [OR] 
    RewriteCond %{REQUEST_URI} ^/iNotes [OR] 
    RewriteCond %{REQUEST_URI} ^/icons [OR] 
    RewriteCond %{REQUEST_URI} ^/iwaredir.nsf [OR] 
    RewriteCond %{REQUEST_URI} ^/names.nsf [OR] 
    RewriteCond %{REQUEST_URI} ^/mail [OR] 
    RewriteCond %{REQUEST_URI} ^/archive [OR] 
    RewriteCond %{REQUEST_URI} ^/download [OR] 
    RewriteCond %{REQUEST_URI} ^/dwa(.*)
    RewriteCond %{HTTP_COOKIE} ^.*iNotesServer=([^;]+)
    RewriteRule /(.*) http://%1.acme.com/$1 [P,L]
    
    # Rule 3 : if no cookie set -> on first access on the iNotes iwaredir.nsf
    RewriteCond %{REQUEST_URI} ^/favicon.ico [OR] 
    RewriteCond %{REQUEST_URI} ^/domcfg.nsf [OR] 
    RewriteCond %{REQUEST_URI} ^/iwaredir.nsf [OR] 
    RewriteCond %{REQUEST_URI} ^/names.nsf
    RewriteRule /(.*) http://domino1.acme.com/$1 [P,L]
    
    # Rule 4 : everything else should be redirected to the original link 
    RewriteCond %{REQUEST_URI} ^/
    RewriteRule / http://domino1.acme.com/ [P]

  • Re: IIS reverse proxy page is not opening

    May 29, 2020 09:29 AM|Yuk Ding|LINK

    Hi rktjp,

    The rule can be convert into URL rewrite rule.

    https://forums.iis.net/t/1250642.aspx

    Best Regards,

    Jokies Ding

    Yuk Ding

    MSDN Community Support
    Please remember to "Mark as Answer" the responses that resolved your issue.
‹ Previous Thread|Next Thread ›