Forum Discussion
nitass
Mar 01, 2013Employee
e.g.
[root@ve10:Active] config b virtual bar list
virtual bar {
snat automap
pool foo
destination 172.28.19.252:80
ip protocol 6
rules myrule
profiles {
http {}
tcp {}
}
}
[root@ve10:Active] config b rule myrule list
rule myrule {
when HTTP_REQUEST {
set subdomain [string map {"www." "" ".domain.com" "" "domain.com" ""} [string tolower [HTTP::host]]]
if { $subdomain ne "" } {
HTTP::redirect "http://www.domain.com/site/$subdomain"
}
}
}
www.domain.com
[root@centos251 ~] curl -I http://172.28.19.252 -H "Host: www.domain.com"
HTTP/1.1 200 OK
Date: Sat, 02 Mar 2013 00:22:03 GMT
Server: Apache/2.2.3 (CentOS)
Last-Modified: Sat, 27 Oct 2012 03:22:35 GMT
ETag: "4183f3-59-f28f94c0"
Accept-Ranges: bytes
Content-Length: 89
Content-Type: text/html; charset=UTF-8
abc.domain.com
[root@centos251 ~] curl -I http://172.28.19.252 -H "Host: abc.domain.com"
HTTP/1.0 302 Found
Location: http://www.domain.com/site/abc
Server: BigIP
Connection: Keep-Alive
Content-Length: 0
www.abc.domain.com
[root@centos251 ~] curl -I http://172.28.19.252 -H "Host: www.abc.domain.com"
HTTP/1.0 302 Found
Location: http://www.domain.com/site/abc
Server: BigIP
Connection: Keep-Alive
Content-Length: 0