matt1985_299432
Apr 11, 2017Nimbostratus
IRULE redirection to maintenance pool based on client IP and cookie...
Hi,
I have a requirement to redirect test clients to a maintenance pool based on client IP address and the client manually inserting a cookie. The process will be..
Server maintenance flag set which takes server out of the live pool and enables it in the maintenance pool. The a test client will set a cookie in browser and get redirected to the active server in the maintenance pool.
I have all this working with the IRULE below (there are actually more sites). However I am wondering if there is a more efficient way to do this (i am fairly new to IRULES)..
Thanks Matt
I think this will do what you need...
when HTTP_REQUEST { if {[class match [HTTP::header "True-Client-IP"] equals MAINTENANCE-CLIENTS]} { if {[HTTP::cookie exists "MAINTENANCE"]} { switch -glob [string tolower [HTTP::uri]] { "/site1*" - "/site2*" - "/site3*" { pool MAINT-A; persist cookie } } go no further return } } switch -glob [string tolower [HTTP::uri]] { "/site1*" { pool POOL-A; persist cookie } "/site2*" { pool POOL-B ; persist cookie } "/site3*" { pool POOL-C; persist cookie } } }