iRule creation based on URI
disclaimer, I do not know iRules for anything......but I have been asked to create on for the following.
here are my requirements, iRule to redirect traffic .
1. if this = https://abc.help.com/support/case/v2/WebCase respond to here = sa.abcs.help.com
2. if this = https://abc.help.com/HBServices/abc/v1/asset/$uri respond to here - hb.abcs.help.com
3. if this = https://abc.help.com/support/assetinfo/v4/getassetwarranty/$uri respondwith 404
4. if this = https://abc.help.com/$uri respond to here = abc2.us.help.com
Here is what I tried .
when HTTP_REQUEST {
if {
([string tolower [HTTP::host]] equals "abc.help.com") &&
([HTTP::uri] contains "/support/case/v2/WebCase")
}
{
HTTP::redirect "https://sa.abcs.help.com[HTTP::uri]"
}
}
elseif {
([string tolower [HTTP::host]] equals "abc.help.com") &&
([HTTP::uri] contains "/hbserial/abc/v1/asset/$uri")
}
{
HTTP::redirect "https://hb.abcs.help.com[HTTP::uri]"
}
}
elseif {
([string tolower [HTTP::host]] equals "abc.help.com") &&
([HTTP::uri] contains "/support/assetinfo/v4/getassetwarranty/$uri")
}
{
HTTP::respond "404 [HTTP::uri]"
}
}
elseif {
([string tolower [HTTP::host]] equals "abc.help.com") &&
([HTTP::uri] contains "/$uri")
}
{
HTTP::redirect "https://abc2.us.help.com[HTTP::uri]"
}
}