Forum Discussion
bmoran_10756
Aug 19, 2011Nimbostratus
If you would like to cut down on the number of comparisons:
when HTTP_REQUEST {
switch -glob [string tolower [HTTP::host]] {
"*[a-z]*" {
Host is hostname, redirect.
HTTP::redirect https://www.[string trimleft [HTTP::host] "www."][HTTP::uri]
}
"" {
Host is null
HTTP::redirect "https://default.example.com[HTTP::uri]"
}
default {
Host is an IP address
HTTP::redirect "https://[HTTP::host][HTTP::uri]"
}
}
}