Forum Discussion
nitass
Aug 21, 2012Employee
in case of using data group.
e.g.
[root@ve10:Active] config b virtual bar list
virtual bar {
destination 172.28.19.79:80
ip protocol 6
rules myrule
profiles {
http {}
tcp {}
}
}
[root@ve10:Active] config b rule myrule list
rule myrule {
when HTTP_REQUEST {
if {[string tolower [HTTP::host]] equals "www.website.com"} {
scan [HTTP::uri] {/%s} cust
set pl [class match -value $cust equals redirect_class]
if {$pl ne ""} {
HTTP::redirect "http://[string map "www $pl" [string tolower [HTTP::host]]][HTTP::uri]"
}
}
}
}
[root@ve10:Active] config b class redirect_class list
class redirect_class {
{
"customer1" { "pool1" }
"customer2" { "pool13" }
"customer3" { "pool4" }
}
}
[root@ve10:Active] config curl -I http://172.28.19.79/customer1 -H "Host: www.website.com"
HTTP/1.0 302 Found
Location: http://pool1.website.com/customer1
Server: BigIP
Connection: Keep-Alive
Content-Length: 0
[root@ve10:Active] config curl -I http://172.28.19.79/customer2 -H "Host: www.website.com"
HTTP/1.0 302 Found
Location: http://pool13.website.com/customer2
Server: BigIP
Connection: Keep-Alive
Content-Length: 0
[root@ve10:Active] config curl -I http://172.28.19.79/customer3 -H "Host: www.website.com"
HTTP/1.0 302 Found
Location: http://pool4.website.com/customer3
Server: BigIP
Connection: Keep-Alive
Content-Length: 0