locked
Reverse Proxy using Rewrite Maps RRS feed

  • Question

  • User-965846884 posted

     I have basic reverse proxys working but I would like to use Rewrite Maps as I potentially have many static pairs that I need to match, not conforming to a standard necessarily.

    Currently I have the following rule.

     <rewrite>
                <rules>
                    <clear />
                    <rule name="ReverseProxy">
                        <match url=".*" />
                        <conditions logicalGrouping="MatchAll">
                            <add input="{StaticMap:{Request_URI}}" pattern="(.+)" />
                        </conditions>
                        <action type="Rewrite" url="http://172.28.75.31:90{C:0}" />
                    </rule>
                </rules>
                <rewriteMaps>
                    <rewriteMap name="StaticMap" defaultValue="/server/">
                        <add key="/server/xhtml/user/fi54321" value="/54321" />
                        <add key="/server/xhtml/user/fi12345" value="/12345" />
                    </rewriteMap>
                </rewriteMaps>
            </rewrite>

     

    So basically I want  http://mydomain.com/54321 to get rewritten to http://172.28.75.31:90/server/xhtml/user/fi54321

    When I enter  http://mydomain.com/54321 I get a 404. After putting in the defaultValue for the rewriteMap it hits that /server/ folder so it appears neither of the two map items actually matches.

     

    Tuesday, June 23, 2009 9:52 AM

All replies

  • User511787461 posted

    Your rewriteMap should look like this

     <rewriteMap name="StaticMap" defaultValue="/server/">
        <add key="54321" value="/server/xhtml/user/fi54321" />
        <add key="12345" value="/server/xhtml/user/fi12345" />
    </rewriteMap>

    Tuesday, June 23, 2009 12:34 PM
  • User-965846884 posted

     That gets me a little further I think but once I flipped the key value pairs and enter http://domain.com/12345 it actuall redirected me to http://domain.com/server/xhtml/user/fi12345 showing me them the "defaultValue" page.

    If I change
    <action type="Rewrite" url="http://172.28.75.31:90{C:0}" />
    to
    <action type="Rewrite" url="http://172.28.75.31:90{C:1}" />

    IIS responds with a 502 error.

    Tuesday, June 23, 2009 1:59 PM
  • User511787461 posted

    Since you say you have basic reverse proxy working, I assume that you have ARR installed and configured.  Can you collect failed request trace log with the new rules?

    Tuesday, June 23, 2009 3:53 PM
  • User-965846884 posted

     Sure thing. Here it goes.


    Tuesday, June 23, 2009 4:24 PM
  • User511787461 posted

    It is impossible to view like this - can you e-mail me the file at anil (dot) ruia (at) microsoft (dot) com?

    Wednesday, June 24, 2009 12:42 PM
  • User-965846884 posted

     Thank you Anil. I sent you an email and deleted above XML.

    Thursday, June 25, 2009 9:48 AM
  • User-965846884 posted

     Anil - sorry I have not followed up earlier but did you get a chance to look at the trace I had sent you?

    Thursday, July 30, 2009 4:13 PM
  • User511787461 posted

    I must have missed it - can you e-mail it to me again - please include link to this thread in your e-mail.

    Thursday, July 30, 2009 4:18 PM
  • User-965846884 posted

     Have you had a chance to take a look? I have resend the zip file.

    Thursday, August 20, 2009 10:23 AM
  • User511787461 posted

    I do not see it in my inbox - when did you send it and what is the e-mail address from which you sent it?

    Thursday, August 20, 2009 1:50 PM