Forum Discussion
Steve_M__153836
Nimbostratus
Jul 07, 2014Redirect on HTTP::host does not work
Here is the configuration. 2 virtuals, same IP address, port 80 is using built in _sys_https_redirect iRule; Port 443 uses the below iRule and an additional that triggers on responses only. They are ...
Kevin_Stewart
Employee
Jul 07, 2014I believe the issue is that you're not terminating evaluation after the first condition. You may be matching on the first condition, but the iRule is going to continue parsing the iRule. Try moving everything into a single if/elseif structure:
when HTTP_REQUEST {
if { [string tolower [HTTP::host]] starts_with "ourdomain.com" } {
HTTP::redirect https://www.ourdomain.com[HTTP::uri]
} elseif { [HTTP::uri] eq "/" } {
HTTP::redirect https://www.ourdomain.com/abc/portal/place
} elseif { ( [HTTP::uri] contains "/mydomainLandingPage" ) } {
HTTP::redirect "https://www.ourdomain.com/abc/portal/place/PageNotFound/"
}
}
Also, you don't need the or ([HTTP::uri] eq "") section. An empty URI will always, at a minimum, contain a "/" character.
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