Forum Discussion

Emre_27149's avatar
Emre_27149
Icon for Nimbostratus rankNimbostratus
May 09, 2011

irule redirection

 

 

I have the below VIP, pool and some alternative irule to successful my goal.

 

 

İncoming requests to http://xyz.com.tr/httpgw (10.x.x.199) distrubutes to the pool httpgw-8086-pool but the URI need to change as 10.x.x.257:8086/httpgw when the requests disturubuted the pool httpgw-8086-pool. I have wrote the below irulus to accomplish my goal but is did not work.so what kind of change I need to perform on the irule to accomplish my goal. Thank you.

 

 

 

 

pool httpgw-8086-pool {

 

monitor all tcp

 

members {

 

10.x.x.157:8086 {}

 

10.x.x.158:8086 {

 

session user disabled

 

}

 

}

 

rule httpgw-irule {

 

when HTTP_REQUEST {

 

if { [string tolower [HTTP::uri]] equals "/" } {

 

HTTP::uri [string map -nocase {"/" "/httpgw"} [HTTP::uri]]

 

}

 

}

 

}

 

rule httpgw-irule-alternate {

 

when HTTP_REQUEST {

 

if { [HTTP::uri] equals "/" } {

 

set newuri "/httpgw"

 

log "Incoming uri - [HTTP::uri] being translated to $newuri"

 

HTTP::uri $newuri

 

}

 

}

 

}

 

rule httpgw-redirection {

 

when HTTP_REQUEST {

 

if { (([HTTP::host] equals "xyz.com.tr") and ([HTTP::uri] equals "/")) } {

 

HTTP::redirect " http://xyz.com.tr/httpgw "

 

}

 

}

 

}

 

virtual httpgw-8086-VIP {

 

pool httpgw-8086-pool

 

destination 10.x.x.199:http

 

ip protocol tcp

 

rules httpgw-irule-alternate

 

persist source_addr

 

profiles {

 

http {}

 

tcp-lan-optimized {

 

clientside

 

}

 

tcp-wan-optimized {

 

serverside

 

}

 

}

 

}

 

 

 

 

 

  • Hi,

     

    The some characters on the above does not appear probably that is below.

     

    "

     

    I have the below VIP, pool and some alternative irule to successful my goal. İncoming requests to http://xyz.com.tr/httpgw (10.x.x.199) distrubutes to the pool httpgw-8086-pool but the URI need to change as 10.x.x.257:8086/httpgw when the requests disturubuted the pool httpgw-8086-pool. I have wrote the below irulu to accomplish my goal but is did not work.so what kind of change I need to perform on the irule to accomplish my goal.

     

    Thank you."

     

     

  • Michael replied here:

     

     

    http://devcentral.f5.com/Community/GroupDetails/tabid/1082223/asg/50/aft/1178852/showtab/groupforums/Default.aspx

     

     

    Aaron