Domai_23823
May 09, 2018Nimbostratus
URI 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 not want 2 URL's which has /monkey/ to be redirected.
Like do not redirect
https://main.you.com/monkey/std/public/v1
and
https://main.you.com/monkey/public/v2
But redirect any other URL that has URI - /monkey/*
The iRule that I came up with and does not work is below. What am I doing wrong?
when HTTP_REQUEST {
if { ([string tolower [HTTP::host]] eq "main.you.com") and ([string tolower [HTTP::uri]] eq "/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]] eq "/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]] eq "/monkey/*") } {
HTTP::redirect "https://side.you.com"
else { use pool main.you.com_pool
}
}