Forum Discussion
Yung_Liu_113940
Nimbostratus
Feb 01, 2006How to direct HTTP request to a particular pool member and keep the persistence (cookie insert mode)
Hi,
I am trying to use iRule to direct http request to a particular pool member if the URI contains ip=x.x.x.x where x.x.x.x is the ip of a pool member. One of the requirement is to keep the persistence using cookie insert mode. Here is what I have, I crated a virtual server (www.testvip.com), a pool (testpool) that consists of following 3 web servers, a cookie insert mode persistence profile and assigned it to the virtual server and following iRule assigned to the virtual server. The iRule works as far as dircting the HTTP request to the correct pool member but the cookie persistence is not working. For example, if I point my browser to http://www.testvip.com/ip=10.0.0.1/test.html and I get the test.html page from 10.0.0.1 but the HTTP response header does not contain any Cookies. If I point my browser to http://www.testvip.com/test.html (without ip=x.x.x.x), BigIP will load balance, pick a web server and sends the test.html page and the Cookie. Did I miss something in my iRule? Any help on this is greatly appreciated.
Thank you,
---------------------------------------------------------------
Web server A - 10.0.0.1
Web server B - 10.0.0.2
Web server C - 10.0.0.3
when HTTP_REQUEST {
set uri [HTTP::uri]
if { $uri contains "ip=" } {
set uri_index [split [HTTP::uri] "/"]
set myserver [string trimleft [lindex $uri_index 1] "/"]
set myserverip [lindex [split $myserver "="] 1]
set newuri [join [lrange $uri_index 2 end]]
HTTP::uri "/$newuri"
persist cookie insert cookiemonster
pool testpool member $myserverip 80
}
else {
pool testpool
}
}
- unRuleY_95363Historic F5 AccountDo you have a cookie persist profile on the virtual server?
... HTTP::uri "/$newuri" Remove this persist command since it is already defined on the virtual pool testpool member $myserverip 80 } else { pool testpool persist none } }
- Yung_Liu_113940
Nimbostratus
- Colin_Walker_12Historic F5 AccountDid you modify your rule as unruley suggested above? If you have the cookie insert profile associated with the virtual, you don't want to set persistence in your rule, or you'll likely stop the profile from doing its job.
- Yung_Liu_113940
Nimbostratus
Colin, - unRuleY_95363Historic F5 AccountHow are you not seeing the Cookie? Are you watching a network trace of the HTTP response going to the client.
- Yung_Liu_113940
Nimbostratus
I am using a software called IEWatch which is a IE plugin that does HTTP traffic analysis. As for contacting F5 technical support, I tried both web support and phone support and in both cases I was told to get help from DevCentral even though we have support contract with F5. - Colin_Walker_12Historic F5 AccountYung,
- Yung_Liu_113940
Nimbostratus
Colin, - unRuleY_95363Historic F5 AccountPlease contact support as this does sound like a bug.
- Don't you need to be setting persistence when HTTP_RESPONSE event happens? If your server does not send back that cookie, you will not see it coming back to the client.
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