Forum Discussion
Joe_H_250786
Nimbostratus
Feb 22, 2016iRule for Secure All The Time Redirect
Hello,
We are trying to implement an iRule to forward all non-secure traffic (via 301) to secure and non-www to wwww
Example:
http to https
http://domain.com -> https://www.domain.com
...
Kai_Wilke
MVP
Feb 22, 2016Hi Joe,
you may try the iRule below as a starting point...
when HTTP_REQUEST {
if { [string tolower [HTTP::host]] starts_with "www." } then {
HTTP::respond 301 Location "https://[getfield [HTTP::host] ":" 1][HTTP::uri]"
} else {
HTTP::respond 301 Location "https://www.[getfield [HTTP::host] ":" 1][HTTP::uri]"
}
}
Cheers, Kai
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