uri rewrite for IIS conversion

Hi I am currently in the process of moving sites away from Microsoft ARR to F5

there are quite a few url rewrites involved and the syntax is causing me an issue

current rule on IIS looks like this

rule name=“Rewrite to details”

match url=“^Details/([0-9]+)/([a-z]+)” /

conditions logicalGrouping=“MatchAll” trackAllCaptures=“false” /

action type=“Rewrite” url=“PropertyDetails.aspx?HID={R:1}&L={R:2}” appendQueryString=“false” /

/rule

the question is how do I write this in irule speak? just the match and the rewrite the rest doesn’t matter

any help would be great

i am not familiar with iis rewrite rule. can you give example url?

hi

I don’t have an example to hand but the this works is the property number is given in value 1 and passed to R:1 and the language code in value 2 R:2

so an example would look something like http://host/details/123/en and the output would be http://host/propertydetails.aspx?HID=123&L=en

hope this helps

thanks

please feel free to revise.

[root@ve1023:Active] config  b virtual bar list
virtual bar {
   snat automap
   pool foo
   destination 172.28.19.79:80
   ip protocol 6
   rules myrule
   profiles {
      http {}
      tcp {}
   }
}
[root@ve1023:Active] config  b pool foo list
pool foo {
   members 200.200.200.101:80 {}
}
[root@ve1023:Active] config  b rule myrule list
rule myrule {
   when HTTP_REQUEST {
        if {[scan [string tolower [HTTP::uri]] {/details/%d/%s} u1 u2] == 2} {
                HTTP::uri "/propertydetails.aspx?HID=${u1}&L=${u2}"
        }
}
}

[root@ve1023:Active] config  ssldump -Aed -nni 0.0 port 80
New TCP connection 1: 172.28.19.253(34582) <-> 172.28.19.79(80)
1327896840.4802 (0.0029)  C>S
---------------------------------------------------------------
GET /details/123/en HTTP/1.1
User-Agent: curl/7.15.5 (i686-redhat-linux-gnu) libcurl/7.15.5 OpenSSL/0.9.8r zlib/1.2.3 libidn/0.6.5
Host: 172.28.19.79
Accept: */*

---------------------------------------------------------------

New TCP connection 2: 200.200.200.10(34582) <-> 200.200.200.101(80)
1327896840.4813 (0.0009)  C>S
---------------------------------------------------------------
GET /propertydetails.aspx?HID=123&L=en HTTP/1.1
User-Agent: curl/7.15.5 (i686-redhat-linux-gnu) libcurl/7.15.5 OpenSSL/0.9.8r zlib/1.2.3 libidn/0.6.5
Host: 172.28.19.79
Accept: */*

---------------------------------------------------------------

Hey Nitass

worked a treat, thanks very much

regards

Darren

Hello Nitass,

I have an issue where the following IIS URL Rewrite is causing 502. The application is Cold Fusion (no jokes please) using TomCat and IIS. If I disable the rule F5 works and hits test html pages on each web server. When the IIS URL Rewrite is enabled it fails.

Is there a way to tweak the rule on IIS to make it work, or will the rules need to reside in an iRule?

Any help is much appreciated.

Error:

502 - Web server received an invalid response while acting as a gateway or proxy server.

There is a problem with the page you are looking for, and it cannot be displayed. When the Web server (while acting as a gateway or proxy) contacted the upstream content server, it received an invalid response from the content server.

IIS URL Rewrite Rules/Code: