zongfeng_101672
Mar 29, 2012Nimbostratus
[HTTP::uri] rewrite fail,help please ,thanks
my f5 has two pool, one pool name is test1, vip is 192.168.1.5 port 80; other pool name is test2,vip is 192.168.1.6 port 80
when user visit http://192.168.1.5/admin,I wish f5 dispatch this request to http://192.168.1.6/manager
i use iRule to control,but it's fail to redirect to other pool !
follow is my iRule:
when HTTP_REQUEST
{
log local0. "http uri before modified: [HTTP::uri]"
switch -glob [HTTP::uri] {
"/admin*" {
set uri value to a temporary variable
set tempuri [HTTP::uri]
log local0. "temprui before replace is $tempuri"
replace "/admin" to "/manager"
set tempuri [string replace $tempuri 0 5 "/manager"]
log local0. "tempuri after replace is $tempuri"
HTTP::uri $tempuri
log local0. "http uri after modified: [HTTP::uri]"
pool test2 }
default { pool test1}
}
}
follow is f5 log:
Thu Mar 29 15:24:03 CST 2012 info local/tmm tmm[3466] Rule adc : temprui before rewrite is /admin
Thu Mar 29 15:24:03 CST 2012 info local/tmm tmm[3466] Rule adc : tempuri after rewrite is /manager
Thu Mar 29 15:24:03 CST 2012 info local/tmm tmm[3466] Rule adc : after replace uri is /admin