Forum Discussion
Aaron_33366
Mar 14, 2011Nimbostratus
Wildcard cookie
Hello. I have migrated my config from a Cisco CSS to an F5 LTM and have run into a problem. One the CSS I was able to have a cookie that was use for all parts of the domain. I was able to set the option called "cookie-domain" on the Cisco CSS and that could would work for all subdomains. Below is a link to that info on Cisco's site.
http://www.cisco.com/en/US/docs/app...wp1178181
I have been looking for this option on the F5 but have not been able to find it. I have look under the persistence profile and creating a new one however I dont see that option for a cookie-domain or anything like a wild card cookie. I am assuming that I might have to do this in an iRule or that the option I need to set is not in the persistence profile are of the GUI and that I might have to make this modification via the CLI with the bigpip command. I currently have a F5 ticket open for this but havent gotten far with it so I thought I would post this question out in the wild and see what I could find.
The key is that if a user goes to site1.domain.com or site2.domain.com or site3.domain.com I need that user to stay stuck/persisted to the same server they were load balanced to. These sites all need to have their own virtual servers because they have SSL so they all need their own IP address.
Below is a link that I found that that shows how to do this in PHP and a snippet from the page. However I need to do this on the F5 and I need to be able to set the value of the cookie to the pool member the user was load balanced to.
http://www.webdeveloper.com/forum/showthread.php?t=198526
PHP Code:
setcookie('name', $value, time()+$duration, '/', '.example.com')
Note the leading dot at the start of the ".example.com".
Thanks in advanced for any help that you can provide on this.
-Aaron
- hooleylistCirrostratusHi Aaron,
- Aaron_33366NimbostratusThanks for that piece of info. Now do you know of a way I can get the pool member variable into the cookie as well? I need to ensure that the cookie will keep the client persisted to the same pool member.
- The_BhattmanNimbostratusHi Aaron,
- Aaron_33366NimbostratusThanks for the reply. I already know how to create the profile for a persistence cookie which I have done. But what I need to be able to do is make that cookie have a domain set in it so that it is for all of my *.domain.com. This way when someone hits virtual server for site1.domain.com they will get a cookie for *.domain.com. Then if that user was to go to site2.domain.com which is a different virtual server that user will still persist to the same server it was load balanced to by looking at the cookie and understand that the cookie is valid for site2.domain.com. Hoolio/Aaron has show the iRule to create the domain part of the cookie, however what I dont understand is how can I set the cookie to have value for the server that was chosen for load balancing.
- hooleylistCirrostratusYou can set the domain on the persistence cookie that LTM sets from the cookie insert persistence profile. You don't need to set or modify the cookie value.
when HTTP_RESPONSE { log local0. "[IP::client_addr]:[TCP::client_port]: Pre Set-Cookies: [HTTP::header values Set-Cookie]" Check if the persistence cookie exists in the response if {[HTTP::cookie exists "My_cookie"]} { set the domain attribute on the persistence cookie HTTP::cookie domain "My_cookie" ".mydomain.com" log local0. "[IP::client_addr]:[TCP::client_port]: Modified domain on My_cookie" } log local0. "[IP::client_addr]:[TCP::client_port]: Post Set-Cookies: [HTTP::header values Set-Cookie]" }
- Chris_MillerAltostratusSeems like RFE time for a domain field within the cookie profile - Anyone disagree?
- Aaron_33366NimbostratusHoolio thanks for the feed back. I think your iRule might do the trick. However your statement about being able to set the cookie domain in the persistence profile is not correct. You can't set the domain there, you can only set the name of the cookie. I'm thinking that you post meant to say "can't" and you just typed "can".
- hooleylistCirrostratusIf you request it, it would be great if the domain could be set based on the domain of the requested host header value. It might also be useful if the field accepted TCL commands and/or so you could set the domain on custom logic.
- hooleylistCirrostratusPosted By Aaron on 03/15/2011 01:52 PM
- Aaron_33366NimbostratusI have emailed the F5 tech support working on my ticket the link to this thread. To get this feature added in future releases do you know how one would go about that? Do you think it would simply be opening a ticket or is there a special process to go through to request this sort of thing?
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