Forum Discussion
Oliviattt_32197
Nimbostratus
May 25, 2017F5 iRule to Secure Cookie with HTTPOnly and Secure but not contains cookie name="cnlfsid"
Hi, We need to Secure Cookie with HTTPOnly and Secure but not contains a cookie name ="cnlfsid"
Here is my code:
when HTTP_RESPONSE {
foreach x [HTTP::cookie names] {
set ckname $x set ckvalue [HTTP::cookie value $x] set ckpath [HTTP::cookie value path]
if{!($ckname equals "cnlfsid")} {
HTTP::cookie remove $x
HTTP::cookie insert name $ckname value $ckvalue path $ckpath version 1
HTTP::cookie secure $ckname enable
HTTP::cookie httponly $ckname enable
}
}
}
but it can't work. Can someone help me to fix it.
Many thanks
- JG
Cumulonimbus
Try this modified version:
when HTTP_RESPONSE { foreach x [HTTP::cookie names] { if { $x equals "cnlfsid" } { continue } set ckname $x set ckvalue [HTTP::cookie value $x] set ckpath [HTTP::cookie $x path] HTTP::cookie remove $x HTTP::cookie insert name $ckname value $ckvalue path $ckpath version 1 HTTP::cookie secure $ckname enable HTTP::cookie httponly $ckname enable } }
.
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