Forum Discussion
PleaseHelpMe_10
Apr 17, 2012Nimbostratus
Disappearing Cookies
First off please excuse my ignorance on this topic, I am very new to this and I am still learning. I'd like to thank everyone in advance for their time and their responses.
Here is my irule:
when HTTP_REQUEST {
Set Variables for manipulation later
set URL [HTTP::host]
set URI [HTTP::uri]
set query [URI::query "$URI"]
set referrer [HTTP::header "referrer"]
set useragent [HTTP::header "User-Agent"]
set cookies [HTTP::cookie names]
Keep requests from going through if they already have the information needed to authenticate successfully.
if {"$URI" contains "SSO" && !("$URI" contains "pfidpadapterid") && !("$URI" contains "favicon.ico")}
{
if {"$useragent" contains "MSIE"}
{
HTTP::cookie insert name "pfidpaid" value "IWA" path "/" domain ".yum.com" version 0
HTTP::cookie insert name "referrer" value "$referrer" path "/" domain ".yum.com" version 0
foreach cookie [HTTP::cookie names] {
log local0. "Cookie $cookie = [HTTP::cookie value $cookie]"
log local0. "Cookie $cookie path = [HTTP::cookie path $cookie]"
log local0. "Cookie $cookie domain = [HTTP::cookie domain $cookie]"
log local0. "Cookie $cookie expires = [HTTP::cookie expires $cookie]"
}
}
else
{
HTTP::cookie insert name "pfidpaid" value "TAMLDAP2" path "/" domain ".yum.com" version 0
HTTP::cookie insert name "referrer" value "$referrer" path "/" domain ".yum.com" version 0
HTTP::cookie expires "referrer" 3600 relative
foreach cookie [HTTP::cookie names] {
log local0. "Cookie $cookie = [HTTP::cookie value $cookie]"
log local0. "Cookie $cookie path = [HTTP::cookie path $cookie]"
log local0. "Cookie $cookie domain = [HTTP::cookie domain $cookie]"
log local0. "Cookie $cookie expires = [HTTP::cookie expires $cookie]"
}
}
}
else
{
return
}
}
As you can see I am setting a couple of cookies in the HTTP_REQUEST. I can see these cookies in the LTM log via the logging that I have setup, but I am unable to see these cookies in the browser using a tool like the FireFox plugin "Web Developer".
I tried using the HTTP::cookie expires functionality, but it appears that you can only do that in the HTTP_RESPONSE and when I check for that cookie in HTTP_RESPONSE I cannot find it.
At first I thought this was the backend server deleting the cookies, but I setup a virtual server that was pointing to a basic Apache web server and used a static HTML page to test this irule and I was still unable to see the cookies that were set.
Any help that you can provide on this would be most appreciated. Thank you again in advance.
- HamishCirrocumulusI think you have the answer above from yourself... HTTP::cookie in a REQUEST adds the cookie to the REQUEST. (BigIP to pool member). NOT to the response. if you want a cookie to be set on the browser, you need to add it in the HTTP_RESPONSE event.
- PleaseHelpMe_10NimbostratusHamish, thank you for your response. I need the cookies to go to the pool member for use later, but I would still expect to see those in the browser. For example, I can see session and/or persistence cookies in the browser. Is there a way to make the cookies that I set in the HTTP_REQUEST a session cookie so that it will stick around for use throughout the session?
- HamishCirrocumulusHi.
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