Forum Discussion

Faintly_Lucky's avatar
Faintly_Lucky
Icon for Nimbostratus rankNimbostratus
Apr 09, 2010

iRule Pool Selection Question

Anyone that knows, please feel free to answer this question.

 

 

When I use an iRule to select a pool based on URI, it chops off the first directory of the URI. Example:

 

 

when CLIENT_ACCEPTED {

 

set default_pool [LB::server pool] }

 

when HTTP_REQUEST {

 

pool $default_pool

 

set uri [string tolower [HTTP::uri]]

 

set query [URI::query [HTTP::uri]]

 

if { $uri starts_with "/smartphone" } {

 

pool pool_name

 

return

 

}

 

}

 

 

In this case when it sees “/smartphone,” it selects just fine, but to “/”, not “/smartphone”. Is this normal? If I’m selecting a pool that has the same servers in it, I have to set the URI to include the first directory by adding this after the pool statement and before the return:

 

if { not ([HTTP::uri] starts_with "/smartphone") } {

 

HTTP::uri /smartphone[HTTP::uri] }

 

 

If I'm doing something wrong here, please don't hesitate to let me know.

 

 

 

Comments?

1 Reply

  • With the first code you've posted, there isn't any modification of the URI, so I'm not sure how the iRule could be affecting the URI. Can you clarify what rule you were testing with and what results you were seeing?

     

     

    Thanks,

     

    Aaron