Forum Discussion

TLL_91858's avatar
TLL_91858
Icon for Cirrus rankCirrus
Jul 22, 2015

specific pool member based on URI reruns causing failure

I have an iRule that runs to allow me to test a specific pool member provided I put a special word in the uri; the application is a java app, and the Java part works fine. The problem is when the application comes back to run a report, it changes the uri and the HTTP_REQUEST runs again putting me in the wrong pool. I thought the cookie would prevent this from happening, but it's not. Here's the code

 

  when HTTP_REQUEST {
if {not [HTTP::cookie exists "admintest"]}
{
  if {[string tolower [HTTP::uri]] ends_with "admin"}
{ pool Test_Pool member 192.168.2.100:80 ; 
log local0. "WELCOME [HTTP::uri]" }
else {
pool TEST_Pool member 192.168.2.200:80 ;
log local0. "This is not the right place" }
}
}
when HTTP_RESPONSE {
   HTTP::cookie insert name "admintest" value "IamTesting"
}

 

  • You need to do something if the cookie is set. eg when HTTP_REQUEST if cookie set, use Test_Pool if cookie not set, check URI, set cookie and use Test_Pool
  • Isn't it doing that? If cookie is not set, run second if statement, else just end and move on??