Forum Discussion
nitass
Nov 24, 2015Employee
is it http or https virtual server?
if http, it is okay but if https, it will cause redirection loop because HTTP::redirect is outside if-condition.
configuration
[root@ve11c:Active:In Sync] config tmsh list ltm virtual bar
ltm virtual bar {
destination 172.28.24.10:443
ip-protocol tcp
mask 255.255.255.255
pool foo
profiles {
clientssl {
context clientside
}
http { }
tcp { }
}
rules {
qux
}
source 0.0.0.0/0
source-address-translation {
type automap
}
vs-index 17
}
[root@ve11c:Active:In Sync] config tmsh list ltm rule qux
ltm rule qux {
when HTTP_REQUEST {
set host [HTTP::host]
if { not ([string tolower [HTTP::host]] starts_with "www.") } {
set host "www.[HTTP::host]"
}
HTTP::redirect "https://$host[HTTP::uri]"
}
}
test
[root@ve11c:Active:In Sync] config curl -ik https://172.28.24.10 -H "Host: www.abc.com"
HTTP/1.0 302 Found
Location: https://www.abc.com/
Server: BigIP
Connection: Keep-Alive
Content-Length: 0