0

Architecture: User --> ARR Server --> LB --> 2 Web Server serving 2 different sites Web Server1 serving -> https://xxxx-green-xxxx-xxxx.net/xxx/xxx?xx=xxxx where green keyword comes in any place in domain name Web Server2 serving -> https://xxxx-yellow-xxxx-xxxx.net/xxx/xxx?xx=xxxx where yellow keyword comes in any place in domain name

Requirement: Request format: https://xxxx-green-xxxx-xxxx.net/xxx/xxx?xx=xxxx or yellow URL In ARR we need to filter the URL with green and yellow keyword in URL and send it to respective Web Server IP.

But all my requests are landing to home page only. and even i am confused that whether changing the host will work but i need to give IP which is different for each web server in LB

We have set this Rule and getting below results:

                <rule name="Green" enabled="true" stopProcessing="true">
                <match url="(.*xxx.net)(/.*)" />
                <conditions logicalGrouping="MatchAll" 
                 trackAllCaptures="false">
                    <add input="{HTTP_HOST}" pattern="green" />
                </conditions>
                <action type="Rewrite" url="https://xx.xxx.xx.xx/{R:2}" 
                 appendQueryString="true" />
                 </rule> 
                 Where R:2 is --> xxx/xxx?xx=xxxx

1 Answer 1

0

As per your question.

You need to write Custom rewrite rule for that. So first refer this link

Into link you can handle your requirement and rewrite to other other web server.

So please follow all the step and write you logic into
Rewrite(string value) method.

Into this method you need to pass your server url from IIS rules and check via condition like below.

 public string Rewrite(string value)
  {
      if(value.Contains("green"))
        {
         return // your rewrite URL here
        }
      else if(value.Contains("yellow"))
        {
         return // your rewrite URL here
        }
    return value;
  }

So it's working as per your requirement.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.