Forum Discussion
Dave_Gerke_2110
Nimbostratus
Oct 29, 2007Cookie Irule Help
IE is blocking cookies for a url because the host name the client comes in on is different than the host name inside the cookie. Client connects on www.xyz.com and a cookie is sent with a host name inside of www.abc.com. The cookie also contains specific customer information, which enables the client to land on a login page with the correct logo. I believe because the host name being sent back in the cookie is different, IE is blocking it when privacy setting is on medium. I need to write an irule which changes the host name inside the cookie back to the original request host name, and then back when the client reconnects. Any help would be greatly appreciated.
- hoolio
Cirrostratus
Hi,when HTTP_RESPONSE { check if the cookie is being set if {[HTTP::cookie exists "some_cookie"}{ set the domain of the cookie to domain_to_set HTTP::cookie domain some_cookie domain_to_set } }
- Dave_Gerke_2110
Nimbostratus
Thanks for your response. Can you tell me if what I have below would work? If a ceretain cookie exists I want to change the domain name from abc to xyz. - hoolio
Cirrostratus
That's close. The first variable for HTTP::cookie domain should be the cookie name you want to modify. This should work:when HTTP_RESPONSE { if {[HTTP::cookie exists abcPlanCode}{ HTTP::cookie domain abcPlanCode www.xyz.com } }
- Dave_Gerke_2110
Nimbostratus
Thank you very much. So the net result is that when a client connects the server sends a cookie, f5 will rewrite the cookie with the same domain name that the client came in on instead of the domain that is inside the cookie? Just want to make sure I am 100% Sorry I am familiar with irule redirects etc....but have never done anything with cookie rewrites. - hoolio
Cirrostratus
Assuming what you replace www.xyz.com with in the iRule is the domain the client is making the request to, then yes. - Dave_Gerke_2110
Nimbostratus
Sorry it has been a while between my post. Thank you for the information. I have one other question though. If I only want the cookie manipulated if the url it comes in on is is www.abc.com and every other url it comes in on I do not want to manipulate. What should I do? - hoolio
Cirrostratus
This should work to only perform the domain change on the cookie sent by the web app if the request is made to www.abc.com:when HTTP_REQUEST { if {[string tolower [HTTP::host]] eq "www.abc.com"}{ set update_cookie 1 } else { set update_cookie 0 } } when HTTP_RESPONSE { if {$update_cookie and [HTTP::cookie exists abcPlanCode]}{ HTTP::cookie domain abcPlanCode www.xyz.com } }
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