this is just another example.
configuration
[root@ve11a:Active:In Sync] config tmsh list ltm rule qux
ltm rule qux {
when HTTP_REQUEST {
switch -glob [string tolower [HTTP::host]] {
"www.mysite.co.uk" { return }
"www.*" { HTTP::redirect "https://[HTTP::host][HTTP::uri]" }
default { HTTP::redirect "[HTTP::host][HTTP::uri]" }
}
}
}
test
[root@ve11a:Active:In Sync] config curl -I /">http://172.28.24.10///">/">http://172.28.24.10/// -H "Host: www.mysite.co.uk"
HTTP/1.1 200 OK
Date: Tue, 25 Nov 2014 13:38:18 GMT
Server: Apache/2.2.3 (CentOS)
Last-Modified: Sun, 09 Feb 2014 08:39:51 GMT
ETag: "41879c-59-2a9c23c0"
Accept-Ranges: bytes
Content-Length: 89
Content-Type: text/html; charset=UTF-8
[root@ve11a:Active:In Sync] config curl -I /">http://172.28.24.10///">/">http://172.28.24.10/// -H "Host: mysite.co.uk"
HTTP/1.0 302 Found
Location: mysite.co.uk/
Server: BigIP
Connection: Keep-Alive
Content-Length: 0
[root@ve11a:Active:In Sync] config curl -I /">http://172.28.24.10///">/">http://172.28.24.10/// -H "Host: yoursite.co.uk"
HTTP/1.0 302 Found
Location: yoursite.co.uk/
Server: BigIP
Connection: Keep-Alive
Content-Length: 0