Forum Discussion
hooleylist
Aug 18, 2011Cirrostratus
Hi Adam,
That looks like a good start. You may also want to handle requests with an IP address in the host header or no value:
when HTTP_REQUEST {
switch -glob [string tolower [HTTP::host]] {
"www.*" {
Host started with "www.". Allow request without redirecting it?
}
"*[a-z]*" {
Host is not null and not an IP address
HTTP::redirect https://[getfield [HTTP::host] ":" 1][HTTP::uri]
}
default {
Host is null or an IP address
HTTP::redirect "https://default.example.com[HTTP::uri]"
}
}
}
Aaron