Alan_Evans_1020
Apr 08, 2009Nimbostratus
iRule (HTTP) to select pool based on URI then continue using that pool for duration of session
I am working on a HTTP iRule where I want to create an iRule that selects a pool based on an entry URI and then have the HTTP session continue using that pool and redirect the user to a regular URI for the service.
In the setup:
SYSTEM
BIG-IP 9.4.4
POOLS
pool_prod (contains nodes prod1..n)
pool_dev (contains nodes dev1..n)
pool_train (contains nodes train1..n)
VIRTUAL SERVERS
vs_site_http - listening on port 80, just does redirects to https (DONE)
vs_site_https - should send traffic to pools based on entry URI (LB is terminating SSL)
INTENDED BEHAVIOR
SCENARIO 1
1. user1 enters on site.com/prod/
2. lb assigns the session to the prod pool
3. lb redirects the user to site.com/servlet/somejsp
4. user1's browser goes to site.com/servlet/somejsp
5. lb having seen user1 enter on /prod/ sends traffic to prod pool
SCENARIO 2
1. user2 enters on site.com/dev/
2. lb assigns session to the prod pool
3. lb redirects user to site.com/servlet/somejsp
4. user2's browser goes to site.com/servlet/somejsp
5. lb having seen user2 enter on /dev/ sends traffic to dev pool
SCENARIO 3
1. user3 enters on site.com/
2. lb treats / URI as /prod/ URI, does like scenario 1
I can persist on cookies, SSL, source or whatever. Pretty flexible, just need to keep a session tied to a pool without expecting the information to be in every requested URI, just the first.
Seems like, excuse the meta code...
HTTP_REQUEST {
if session not already seen {
select the beginning of URI from class or switch on it
set a cookie or create a persistence table entry
send a redirect
}
}
It looks like 'persist add' might be all I need, but the wiki page is a little terse and I am still looking for other docs. Is persistence smart enough to keep a connection in a pool and assigned to a specific node?
Can anyone help me out?