Forum Discussion
Adam_Borders_10
Aug 18, 2011Nimbostratus
iRule Newbie learning - need validation
I want to validate the this iRule will do as I think. What I want to do is evaluate the request for a redirect to https. If the user connects to domain.com instead of www.domain.com I want to add the ...
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]"
}
}
}
Recent Discussions
Related Content
DevCentral Quicklinks
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com
Discover DevCentral Connects