Forum Discussion
Domai_23823
Nimbostratus
May 09, 2018URI redirect iRule review/Help
Hello Guys,
I have a question or review request for the below iRule. let me tell you about the requirement first.
The user needs redirect to any URI that starts with /monkey/* BUT does...
Samir_Jha_52506
Noctilucent
May 09, 2018Did some modification in irule. Either use
start_with or contains
place of eq
in syntex. It will work. Please let us know if any issue
when HTTP_REQUEST {
if { ([string tolower [HTTP::host]] eq "main.you.com") and ([string tolower [HTTP::uri]] starts_with "/monkey/std/public/v1") } {
HTTP::redirect "https://main.you.com/monkey/std/public/v1"
}
elseif { ([string tolower [HTTP::host]] eq "main.you.com") and ([string tolower [HTTP::uri]] starts_with "/monkey/public/v2") } {
HTTP::redirect "https://main.you.com/monkey/public/v2"
}
elseif { ([string tolower [HTTP::host]] eq "main.you.com") and ([string tolower [HTTP::uri]] starts_with "/monkey/*") } {
HTTP::redirect "https://side.you.com" }
else { pool main.you.com_pool }
}
Nandhini_Natara
Nimbostratus
May 09, 2018Hello Domai,
Please try with below irule
when HTTP_REQUEST {
if { ([string tolower [HTTP::host]] starts_with "main.you.com") and ([string tolower [HTTP::uri]] starts_with "/monkey/std/public/v1") } {
HTTP::redirect "[https://main.you.com/monkey/std/public/v1"](https://main.you.com/monkey/std/public/v1);
}
elseif { ([string tolower [HTTP::host]] starts_with "main.you.com") and ([string tolower [HTTP::uri]] starts_with "/monkey/public/v2") } {
HTTP::redirect "[https://main.you.com/monkey/public/v2"](https://main.you.com/monkey/public/v2);
}
elseif { ([string tolower [HTTP::host]] starts_with "main.you.com") and ([string tolower [HTTP::uri]] starts_with "/monkey/") } {
HTTP::redirect "[https://side.you.com"](https://side.you.com); }
else { pool main.you.com_pool }
}
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