Forum Discussion
Pierce_Fortin
Nimbostratus
Dec 12, 2017iRule replace substring in cookie name
Hi,
I need to write an iRule which will rewrite part of the cookie name and the cookie path. For example:
Set-Cookie: ASP.NET_SessionId=f3izvd1kvrlsfy0wc2ui1t5k;Path=/ needs to become:
Set-Cook...
Pierce_Fortin
Nimbostratus
Dec 12, 2017I wrongly understood how cookies were formatted. This works for me:
when HTTP_RESPONSE {
set cookies [HTTP::cookie names]
foreach cookie $cookies {
set cookie_value [HTTP::cookie $cookie]
set cookie_path [string map -nocase {"/" "/FOO-BAR/"}
[HTTP::cookie path $cookie]]
HTTP::cookie remove $cookie
HTTP::cookie insert name Special-Name value $cookie_value path $cookie_path
}
}
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