Forum Discussion
mnb_63148
Nimbostratus
Mar 04, 2014Is there a way to tell the cookie version via a tcpdump?
Is there a way to tell the version attribute of a cookie in a wireshark capture? When I look through a packet capture, I do not see a cookie version. I am about to deploy the following iRule to set t...
Kevin_Stewart
Employee
Mar 06, 2014You can technically see the "version" attribute in the Set-Cookie header via TCPDUMP, but for the sake of setting the HTTPOnly attribute in an iRule, I've always had problems setting the version and expires attributes using the HTTP::cookie commands. Here's something that should provide what you need:
when HTTP_RESPONSE {
foreach aCookie [HTTP::cookie names] {
if the cookie does not already have an HttpOnly attribute
if { [HTTP::cookie httponly $aCookie] equals "disable" } {
set value [HTTP::cookie value $aCookie]
set path [HTTP::cookie path $aCookie]
insert domain only if it exists
if { [HTTP::cookie domain $aCookie] ne "" } { set domain "domain=[HTTP::cookie domain $aCookie];" } else { set domain "" }
insert expires only if it exists
if { [HTTP::cookie expires $aCookie] ne "" } {
set expires_local [clock format [expr [clock seconds] + [HTTP::cookie expires $aCookie]] -format "%a, %d-%b-%Y %H:%M:%S GMT" -gmt true]
set expires "expires=$expires_local;"
} else {
set expires ""
}
remove the original cookie
HTTP::cookie remove $aCookie
insert a new cookie via HTTP header inject
HTTP::header insert "Set-Cookie" "$aCookie=$value;path=$path;${domain}${expires}HttpOnly;"
}
}
}
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