Forum Discussion
Hyder_141209
Jul 13, 2017Altostratus
User ID based pool selection
hi there!
I am trying to write one iRule to select the pool based on user ID. For example, when the user tries to login, grab the ID of test1@example.com and send to pool1 and for other user ID ...
Stanislas_Piro2
Jul 21, 2017Cumulonimbus
Hi,
You can try something like that
when CLIENT_ACCEPTED {
set default_pool [LB::server pool]
}
when HTTP_REQUEST {
set logout 0
switch [HTTP::path] {
"/login" {
define condition to select pool2
if some condition {
set pool pool2
} else {
set pool $default_pool
}
"/logout" {
set logout 1
if {[set cookie_pool [HTTP::cookie value selectpool]] ne ""} {
set pool $cookie_pool
}
}
default {
if {[set cookie_pool [HTTP::cookie value selectpool]] ne ""} {
set pool $cookie_pool
}
}
}
pool $pool
}
when HTTP_RESPONSE {
if {$logout} {
HTTP::header insert "Set-Cookie" "selectpool=$pool;expires=Thu, 01 Jan 1970 00:00:00 GMT;path=/;secure"
} elseif {$pool ne $default_pool}{
HTTP::header insert "Set-Cookie" "selectpool=$pool;path=/;secure"
}
}
Recent Discussions
Related Content
DevCentral Quicklinks
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com
Discover DevCentral Connects