Forum Discussion
Kenny_Van_73892
Nimbostratus
Feb 12, 2009strip away www. and redirect to https:// without cert mismatch error
I need some help to clear my mind.
I need to strip away www. from host either on port 80 or 443 and redirect to https://. For instance, if user enters http or https://www.sub.mycompany...
Kenny_Van_73892
Nimbostratus
Feb 12, 2009I did some searches on this forum but wonder if this would work or not
when HTTP_REQUEST {
strip away www. before BigIP check for SSL cert
if { [HTTP::host] starts_with "www." } {
HTTP::header replace "Host" [string range [HTTP::host] 4 end]
}
if { [TCP::local_port] equals 80} {
HTTP::redirect https://[getfield [HTTP::host] ":" 1][HTTP::uri]
if {$::debug}{log local0. "redirecting client [IP::client_addr] to https://[getfield [HTTP::host] \":\" 1][HTTP::uri]"}
} else {
Rewrite the HTTP::path to lower case if the option is enabled globally or in a separate rule
if {$::rewrite_uri_to_lower_case or ([info exists rewrite_uri_to_lower_case] and $rewrite_uri_to_lower_case)}{
HTTP::path [string tolower [HTTP::path]]
}
}
}
I have no way to test this since the site is in production.
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)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