Forum Discussion
Julian_Grunnell
Nimbostratus
Jun 12, 2007Cookie Rewrite & ASPSESSIONID
Hi - got a problem with session persistence and am wondering if an iRule can help? The scenario is:
10 x (customer) IIS web servers that make use of ASPSESSIONID's.
A pair of LTM's that use round robin LB and also have Cookie Rewrite enabled for persistence. So the LTM intercepts the blank BIGipCookie cookie from the IIS web server. BUT the IIS server also sometimes sends the ASPSESSIONID cookie depending on whether a user has got to a particular page. So they are not always sent.
The problem we are seeing is if the LTM just receives the blank BIGipCookie all is fine, but if it receives the ASPSESSIONID cookie as well the client gets re-load balanced.
Hope someone can help.
Thanks - Julian.
- hoolio
Cirrostratus
Hello, - Julian_Grunnell
Nimbostratus
Hi - yes I believe these are session based to ensure that once a user logs into this website not only can we direct them back to the same server but the ASPSESSIONID refers to a specific user on that server if that makes sense. As we don't admin the web servers at all, just the LTM's I don't have a great deal of knowledge on this area. We have been told that an ASPSESSIONID from server "A" is useless on server "B". - hoolio
Cirrostratus
The ASPSESSIONID cookie name is specific to the IIS server and is based on the process ID of the IIS instance. The name should be remain unchanged so long as the PID for IIS stays the same. The value of the cookie is specific to the user session.when HTTP_REQUEST { set persist_cookie_name "persist_cookie" set request_info "client: [IP::client_addr] -> [HTTP::uri]; Request cookies:" inspect cookies if any are sent in the request if {[HTTP::header exists "Cookie"]}{ loop through the names of all the cookies in the request foreach aCookie [HTTP::cookie names] { it's the ASPSESSIONID cookie, save the full name of the cookie (ASPSESSIONIDABCDEFGH) if { [string tolower $aCookie] starts_with "aspsessionid"}{ set aspsessionid_name_request $aCookie set request_info "$request_info $aCookie=[HTTP::cookie value $aCookie];" } elseif {[string tolower $aCookie] eq $persist_cookie_name}{ save the cookie value if it's the persistence cookie set persist_cookie_value_request [HTTP::cookie value $aCookie] set request_info "$request_info $aCookie=[HTTP::cookie value $aCookie];" } } } } when LB_SELECTED { save the pool name, IP and port for the selected node set request_info "$request_info selected node info: [LB::server]" } when HTTP_RESPONSE { set request_info "$request_info; Response cookies: " loop through the names of all the cookies in the response foreach aCookie [HTTP::cookie names] { it's the ASPSESSIONID cookie, save the full name of the cookie (ASPSESSIONIDABCDEFGH) if { [string tolower $aCookie] starts_with "aspsessionid"}{ set aspsessionid_name_response $aCookie set request_info "$request_info $aCookie=[HTTP::cookie value $aCookie];" } elseif {[string tolower $aCookie] eq $persist_cookie_name}{ save the cookie value if it's the persistence cookie set persist_cookie_value_response [HTTP::cookie value $aCookie] set request_info "$request_info $aCookie=[HTTP::cookie value $aCookie];" } } If the request contained an ASPSESSIONID or persist cookie, then the response should not. This is because the BIG-IP and IIS servers servers only set the cookies if the client doesn't present a cookie or the cookie the client does present is invalid if { ([info exists persist_cookie_value_request] and [info exists persist_cookie_value_response]) or ([info exists aspsessionid_name_request] and [info exists aspsessionid_name_response])}{ set request_info "$request_info; PERSIST FAILURE!" } log local0. "\$request_info: $request_info" }
- hoolio
Cirrostratus
Why not just use cookie insert persistence? It eliminates any dependence on the nodes setting cookies and is much less complex to configure and maintain. - Julian_Grunnell
Nimbostratus
Posted By hoolio on 06/12/2007 8:01 AM
- hoolio
Cirrostratus
If you are using cookie insert persistence, the client request should be load balanced to the same node irrespective of what cookie the node might set. There might be application level errors but these shouldn't affect the LTM's reading of the persistence cookie or selecting the node specified in the cookie.
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