Search for specifc text in URL

Firstly, I hate posting things when they should be easy to get working.. but this is doing my head in and it’s so simple. All I want to do is look at the url and get the F5 to look at the string and if it contains the text lcccat=ecs then send it to a specific pool. If it doesn’t match that string then do nothing.

This is what i’ve got. Any help would be appreciated:

when HTTP_REQUEST {

if {[HTTP::uri] contains “lcccat=ecs” } {

pool internal.google.server

}

}

That looks good. I’d suggest getting/setting the default pool on the VIP though. If a request comes in on one TCP connection and matches the condition in your rule it will go to the internal.google.server pool. If a second request comes in over that same TCP connection and does not match the condition, it will also go to internal.google.server pool--not the default pool configured on the VIP as you may expect.

For more info, check this post: (Click here).

To handle this scenario, you can get the default pool and use it if the request doesn’t match the condition:

when CLIENT_ACCEPTED {
   set default_pool [LB::server pool]
}
when HTTP_REQUEST {
   if {[HTTP::uri] contains "lcccat=ecs" } {
      pool internal.google.server
   }
   else {
      pool $default_pool
   }
}

Aaron