Forum Discussion
abewu_915
Nov 20, 2007Nimbostratus
The new iRule worked great! Thank you for your help! For reference, here is the new iRule:
when HTTP_REQUEST {
Set the Cookie Name automatically based on the server pool name
set cookie_name "BIGipServer[LB::server pool]"
log "cookie_name $cookie_name"
Find the correct cookie domain dynamically based on the host in the URL.
set host [HTTP::host]
Use the substring from the first dot to the end of the string.
set cookie_domain [findstr $host "."]
Set the Cookie Domain for this site
log "cookie domain is $cookie_domain"
}
when HTTP_RESPONSE {
We need to rewrite the cookies used by the application, because they have the wrong domain.
if {[HTTP::cookie count] > 0}{
if {[HTTP::cookie exists "$cookie_name"]}{
HTTP::cookie domain $cookie_name $cookie_domain
log "rewriting cookie domain: cookie=$cookie_name, domain=$cookie_domain"
}
}
}