Forum Discussion
Meena_60179
Nimbostratus
May 04, 2010Pool Settings on Http redirect
I have two pools in one virtual server both pool serves different applications (like gmail & docs) and there is one pool for authenticating user request which is default pool for this virtual server, user can access any pool after logging in depending on which application he wants to go to. That setting is stored in a cookie. After user logs into desired application his session needs to be persisted across session.
But for some reason even after setting Http pool to appserver_pool_1 or appserver_pool_2 subsequent requests point to auth pool instead of desired pool and I get an error. The only reason I could think of here is when user goes to any server inside i.e. appserver_pool_1, that server redirects him to a page and all subsequent requests who has session comes after redirection, could that cause an issue here? How can I resolve that issue.
I appreciate your help very much, thanks.
- Meena_60179
Nimbostratus
Here is the iRule I am usingwhen HTTP_REQUEST { set uri [ HTTP::uri ] if { $uri contains "myapp" } { find out if session id is defined set sessionId [ HTTP::cookie "JSESSIONID" ] if { $sessionId == "" } { look for auth cookie set authCookie [ HTTP::cookie "auth.mail.com" ] set location [HTTP::cookie "mail_location" ] if { $authCookie != "" and $location != "" } { if { $location equals "mailloc" } { pool appserver_pool_1 } elseif {$location equals "docloc" } { pool appserver_pool_2 } } else { Redirect to authentication page HTTP::redirect "http://10.10.0.1/auth/" } } else { persist session persist uie $sessionId 3600 } } } when HTTP_RESPONSE { set SessionId [HTTP::cookie "JSESSIONID"] if { $SessionId != "" }{ log "app server has set JSESSIONID $SessionId add persistence" persist off session id for an hour (3600 seconds) persist add uie $SessionId 3600 } }
- Meena_60179
Nimbostratus
Can some one please help me here, since I am new to iRule I got no clue on how can I set up this persistence for two pools and to the servers inside any pool. - hoolio
Cirrostratus
Hi Meena, - Meena_60179
Nimbostratus
I want to select the pool only when user logs in for the first time i.e. when $location != "" and $authCookie != "" , I am assuming that for next subsequent requests this pool settings will be persisted and app_server_pool_1 will serve all the request for this session (since I have persistence based on JSESSIONID). Is there anything wrong with this approach or am I missing something here. I do have couple of HTTP redirects , are those breaking pool settings? I tried adding this code into above mentioned iRulesession exist else { persist uie $sessionId 3600 set location [HTTP::cookie "my_location"] if {$location equals "mail_loc"} { pool app_server_pool_1 }else { pool app_server_pool_2 } }
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