Forum Discussion
David_Oertli_18
Nimbostratus
Jun 20, 2017iRule to rewrite specific cookies to be secure
I am looking for assistance with re-writing cookie's set by a back end real server to be secure. I have read the below articles and am unable to convert the logic provided in this article to only re-write two specific cookie names. Also below is my attempt to get this to work.
https://support.f5.com/csp/article/K11324
and
https://devcentral.f5.com/questions/rewriting-cookies
when HTTP_RESPONSE {
set cookie_names [HTTP::cookie names]
if { $cookie_names contains "cookie1" || "cookie2" } {
foreach cookie $cookie_names {
HTTP::cookie secure $cookie enable }
log local0. "The cookie $cookie was found and attributes modified."
}
}
Not sure what the problem is logging doesn't show me what I am looking for.
- crodriguezRet. Employee
Try something like this:
when HTTP_RESPONSE { foreach cookie [HTTP::cookie names] { if { $cookie contains "cookie1" || $cookie contains "cookie2" } { HTTP::cookie secure $cookie 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