Forum Discussion
3 Replies
Sort By
- kunjanNimbostratus
Try this
set newuri {/aa/bb/cc/} set str [split [lindex [split [HTTP::uri] /] end] -] set parm "t1=[lindex $str 0],t2=[lindex $str 1],t2=[lindex $str 2]" HTTP::uri "$newuri?$parm"
- Jay_Prasanth_13Nimbostratus
Thank you , I got the clue. Below rule worked for me. But minor issue popping up now.
if { [HTTP::uri] starts_with "/aa/bb/cc/" } { set PREFIX_STATIC "/cs/ccs-cctc/jobs" set XX_VAL [ getfield [HTTP::uri] "-" 2] set YY_VAL [ getfield [HTTP::uri] "-" 3] set ZZ_VAL [ getfield [HTTP::uri] "-" 4] set XX_NEW [split [lindex [split $XX_VAL /] end] -] HTTP::uri "$PREFIX_STATIC?q1=$XX_NEW&q2=$YY_VAL&q3=$ZZ_VAL" }
This iRule only picking the 4 the field value "zz" not adding subsequent values to URI.
For eg. If user hit http://abc.com/aa/bb/cc/xx-yy-zz-blah-blah , endresult should be http://abc.com/aa/bb/cc?q1=xx&q2=yy&q3=zz-blah-blah
- nitassEmployeee.g. configuration root@(ve11a)(cfg-sync In Sync)(Active)(/Common)(tmos) list ltm virtual bar ltm virtual bar { destination 172.28.24.10:80 ip-protocol tcp mask 255.255.255.255 pool foo profiles { http { } tcp { } } rules { qux } source 0.0.0.0/0 source-address-translation { type automap } vs-index 3 } root@(ve11a)(cfg-sync In Sync)(Active)(/Common)(tmos) list ltm pool foo ltm pool foo { members { 200.200.200.101:80 { address 200.200.200.101 } } } root@(ve11a)(cfg-sync In Sync)(Active)(/Common)(tmos) list ltm rule qux ltm rule qux { when HTTP_REQUEST { if { [HTTP::uri] starts_with "/aa/bb/cc/" } { if { [scan [HTTP::uri] {/aa/bb/cc/%[^-]-%[^-]-%s} a b c] == 3 } { set PREFIX_STATIC "/cs/ccs-cctc/jobs" HTTP::uri "${PREFIX_STATIC}?q1=${a}&q2=${b}&q3=${c}" } } } } trace [root@ve11a:Active:In Sync] config ssldump -Aed -nni 0.0 port 80 New TCP connection 1: 172.28.24.1(38566) <-> 172.28.24.10(80) 1415107890.5317 (0.0013) C>S --------------------------------------------------------------- GET /aa/bb/cc/xx-yy-zz-blah-blah HTTP/1.1 User-Agent: curl/7.15.5 (i686-redhat-linux-gnu) libcurl/7.15.5 OpenSSL/0.9.8b zlib/1.2.3 libidn/0.6.5 Host: 172.28.24.10 Accept: */* --------------------------------------------------------------- New TCP connection 2: 200.200.200.14(38566) <-> 200.200.200.101(80) 1415107890.5377 (0.0045) C>S --------------------------------------------------------------- GET /cs/ccs-cctc/jobs?q1=xx&q2=yy&q3=zz-blah-blah HTTP/1.1 User-Agent: curl/7.15.5 (i686-redhat-linux-gnu) libcurl/7.15.5 OpenSSL/0.9.8b zlib/1.2.3 libidn/0.6.5 Host: 172.28.24.10 Accept: */* ---------------------------------------------------------------