Forum Discussion
lipos_54863
Nimbostratus
Aug 18, 2009Creating a cookie on the F5s and sharing persistance between HTTP and HTTPS
Hi,
I'm working on an iRule for creating a cookie on the F5s and sharing the persistence between HTTP and HTTPS.
HTTP and HTTPS VS are sharing the same POOL since SSL offloading is being done for HTTPS.
I created something like this:
when HTTP_RESPONSE {
if { [HTTP::cookie exists "cookie_lb"] }{
persist add uie [HTTP::cookie "cookie_lb"]
log local0.debug "Cookie persist - client IP: [IP::client_addr], Cookie: [HTTP::cookie "cookie_lb"], Server IP: [IP::server_addr]"
} else {
set a_cookie [expr {int(5000 * rand())}]
HTTP::cookie insert name cookie_lb value $a_cookie
persist add uie [HTTP::cookie "cookie_lb"]
log local0.debug "Create cookie and persist - client IP: [IP::client_addr], Cookie: $a_cookie, Server IP: [IP::server_addr]"
}
}
when HTTP_REQUEST {
if { [HTTP::cookie exists "cookie_lb"] } {
persist uie [HTTP::cookie "cookie_lb"]
}
}
Is this the correct approach?
Is there a better way of doing it?
- hoolio
Cirrostratus
You can actually do this without an iRule if the requests are going to the same pool. See this post from Deb for details: - lipos_54863
Nimbostratus
Do you mean that default cookie insert method will work for both HTTP and HTTPS if I will assign the same cookie profile to them?? - hoolio
Cirrostratus
Sorry, that wasn't clear. Yes, if the same pool is referenced, you can assign the same cookie insert persistence profile to both the HTTP and HTTPS virtual servers. As the same pool is used for both pools, the same pool member will be selected for requests to either virtual server. - hoolio
Cirrostratus
Good to hear. Sorry for any confusion on the incorrect link above.
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