Forum Discussion
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 thi...
nitass
Apr 06, 2012Employee
have you done what Aaron suggested? what is the result in v9? you may add more log command.
e.g.
[root@ve1023:Active] config b virtual bar list
virtual bar {
snat automap
destination 172.28.19.79:80
ip protocol 6
rules myrule
profiles {
http {}
tcp {}
}
}
[root@ve1023:Active] config b rule myrule list
rule myrule {
when HTTP_REQUEST {
set orguri [HTTP::uri]
log local0. "http uri before modified: $orguri"
switch -glob [HTTP::uri] {
"/admin*" {
set tempuri [HTTP::uri]
log local0. "temprui before replace is $tempuri"
set tempuri [string replace $tempuri 0 5 "/manager"]
log local0. "tempuri after replace is $tempuri"
HTTP::uri $tempuri
pool test2
}
default {
pool test1
}
}
}
when HTTP_REQUEST priority 501 {
set newuri [HTTP::uri]
log local0. "Updated URI in 501: $newuri"
}
when SERVER_CONNECTED {
log local0. "[IP::client_addr]:[TCP::client_port]|[IP::local_addr clientside]:[TCP::local_port clientside]|$orguri|[LB::server pool]|[IP::remote_addr]:[TCP::remote_port]|$newuri"
}
}
[root@ve1023:Active] config b pool test2 list
pool test2 {
members 200.200.200.102:80 {}
}
[root@ve1023:Active] config cat /var/log/ltm
Apr 5 21:54:49 local/tmm info tmm[4797]: Rule myrule : http uri before modified: /admin123
Apr 5 21:54:49 local/tmm info tmm[4797]: Rule myrule : temprui before replace is /admin123
Apr 5 21:54:49 local/tmm info tmm[4797]: Rule myrule : tempuri after replace is /manager123
Apr 5 21:54:49 local/tmm info tmm[4797]: Rule myrule : Updated URI in 501: /manager123
Apr 5 21:54:49 local/tmm info tmm[4797]: Rule myrule : 172.28.19.80:33410|172.28.19.79:80|/admin123|test2|200.200.200.102:80|/manager123
Recent Discussions
Related Content
DevCentral Quicklinks
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com
Discover DevCentral Connects