Forum Discussion
Redirect https:// to https://www
If you have both hostname.net and www.hostname.net on the same virtual, this iRule will result in an infinite loop as you are using a "contains" comparison and "www.hostname.net" contains "hostname.net" and it will in turn redirect to "www.www.hsotname.net". I'd try something like this
when HTTP_REQUEST {
if { !([HTTP::host] starts_with "www.") &&
([HTTP::host] contains "hostname.net") ) {
HTTP::redirect "https://www.[HTTP::host][HTTP::uri]"
}
}
Whether you leave in the second condition is up to you. It may very well work just by checking whether or not the host starts with "www.".
Also keep in mind that if this is on a SSL vip, you'll have to be terminating SSL for the iRule to be able to look at the HTTP request. But, I'm assuming you are doing this anyway since you are using a class profile.
-Joe
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
* 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