Forum Discussion
dgytech
Altostratus
Jul 25, 2017Exclude specific cookie from set_cookie_header iRule
We currently apply "Secure" and "HttpOnly" via the iRule below. We now need to exclude any cookie that starts with "XSRF-TOKEN" from the "HttpOnly" portion of this iRule. Any help in syntax would b...
dgytech
Altostratus
Jul 26, 2017Thank you again for your assistance, very much appreciated!! We were able to get it to work with a few tweaks.
when HTTP_RESPONSE {
set unsafe_cookie_headers [HTTP::header values "Set-Cookie"]
HTTP::header remove "Set-Cookie"
foreach set_cookie_header $unsafe_cookie_headers {
if { $set_cookie_header starts_with "XSRF-TOKEN"} then {
HTTP::header insert "Set-Cookie" "${set_cookie_header}; Secure"
} else {
HTTP::header insert "Set-Cookie" "${set_cookie_header}; Secure; HttpOnly"
}
}
}
- Lee_SutcliffeJul 26, 2017
Nacreous
Pleased you got it working and thanks for sharing the final solution. :)
MP
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