Forum Discussion
Rupa_34586
Nimbostratus
Dec 30, 2009irule is taking wrong cookie
I am using the below irule for cookie based routing.
The irule is not taking the cookie value properly.I am observing cookies on my browser using HTTP Watch pro.
I see JTAP=POD25 in httpwatch pro and in Irule logs i see JTAP=POD2. I am not sure from where the irule is taking the value POD2. Could somebody please tell wheres wrong
if { [HTTP::cookie "JTAP"] ne "" } {
log local0. " Web tier: *** Found JTAP Cookie: [HTTP::cookie JTAP]"
set JTAP [string tolower [getfield [HTTP::cookie "JTAP"] "^" 3]]
pool p_$JTAP
log local0. "Web tier: *** Request went to $JTAP"
}
else {
pool p_default
}
Thanks for your help and have a Happy New Year
6 Replies
- The_Bhattman
Nimbostratus
Hi Rupa,
Looking at your irule it appears that there are several items in JTAP? Something like "JTAP=value^value2^value3" and you are trying to extra the 3rd field? Just need to understand why you needed the getfield
Bhattman - Rupa_34586
Nimbostratus
Hi Bhattman,
Sorry my bad,
My cookie JTAP looks like pay^app^pod25. i am retriving the 3rd value from that.Because i named the pool with the 3rd value.
if you see the first log statement in my irule
log local0. " Web tier: *** Found JTAP Cookie: [HTTP::cookie JTAP]"
I am logging the JTAP value. I am getting pay^app^pod2 in the logs.But in HTTP watch pro i see JTAP=pay^app^pod25
what could be the problem?
Regards,
Rupa - hoolio
Cirrostratus
Hi Rupa,
The iRule looks straightforward enough. Can you post a sample from the ltm log for a failure?
Here is a quick test showing the parsing working correctly:when RULE_INIT { set cookie "abc^def^ghi" log local0. " \$cookie: $cookie; \[getfield $cookie \"^\" 3\]: [getfield $cookie "^" 3]" }
And the ltm log output:
Rule : $cookie: abc^def^ghi; [getfield abc^def^ghi "^" 3]: ghi
Thanks,
Aaron - hoolio
Cirrostratus
Hi Rupa,
I was asking if you could post the log output from these two log lines:
log local0. "Web tier: *** Found JTAP Cookie: [HTTP::cookie JTAP]"
log local0. "Web tier: *** Request went to $JTAP"
Also, can you clarify which host you captured the tcpdump. If it was on LTM, was it on the client or server VLAN?
Thanks,
Aaron - Rupa_34586
Nimbostratus
thanks for your reply,
there is no issue with F5.My webserver is truncating the cookie. - hoolio
Cirrostratus
Glad you figured out the problem. Thanks for clarifying it.
Aaron
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)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