Danielseyoum
Jan 23, 2008Altostratus
Calling another iRule from with in an iRule
I am inspecting the header for cookie and would like to direct the request accordingly. If cookie is not there the landing page will issue the cookie according to the user's choice of department. By the way all the URLs resolve to the same VIP.
The challenge I am facing is to make sure the URIs are valid for the corresponding URL. Meaning I have to allow certain URI only. I have an other iRule using switch. Can I call another iRule for the matching cookie i.e. call HR_iRule for HR cookie? If so how?
Cookie_iRule
when HTTP_REQUEST {
switch [HTTP::cookie Department] {
"SALES" { HTTP::redirect "http://sales.abc.com"}
"HR" { HTTP::redirect "http://hr.abc.com"}
"IT" { HTTP::redirect "http://it.abc.com"}
default{HTTP::redirect "http://www.abc.com}
}
HR_iRule
when HTTP_REQUEST {
switch [string tolower [getfield [HTTP::uri] "/" 2]]
"benefits"{ HTTP::redirect "http://hr.abc.com/portal/Benefits"}
"ethics"{ HTTP::redirect "http://hr.abc.com/portal/Ethics"}
default{HTTP::redirect "http://hr.abc.com/portal}
}