HI
I am new to iRules and have a need to check the content of a cookied, if it matches then I need to send to a pool if not re-direct it to a sorry page. Below is what I have:
when HTTP_REQUEST {
if { [HTTP::cookie contains “abcdefgh”] }
{
pool test
}
else { [HTTP::redirect http:\\sorry.x.y]}
}
I have also tried using HTTP_RESPONSE, the F5 takes the rule but in the statistics it fails each time its used.
Thanks for all your help.
add this line and watch the logs…
log local0. “check for [HTTP::cookie contains]”
Hi
To clarify:
when HTTP_REQUEST {
if { [HTTP::cookie contains “abcdefgh”] log local0.}
{
pool test
}
else { [HTTP::redirect http:\\sorry.x.y]}
}
Is this correct?
Ramesh -
You want to do:
when HTTP_REQUEST {
log local0. "check for [HTTP::cookie contains]"
if { [HTTP::cookie contains "abcdefgh"] }
{
pool test
}
else { [HTTP::redirect http:\\sorry.x.y]}
}
Also, what is the name of the cookie that is being tested?
I am not sure of the name but we can give it a value, I am in the process of finding this out. So once I put this line, how do I check whats going on? Is there a command line command I can type to see the data?
Thanks for all your help, after much work I have created what I needed:
when HTTP_REQUEST {
log local0. “check for [HTTP::cookie value ]”
if { [HTTP::cookie value log local0. “Found cookie”
pool test
} else {
log local0. “No cookie”
HTTP::redirect “http://sorry.x.y”
}
}