Forum Discussion
Chad_Roberts_21
Nimbostratus
Jan 19, 2007Securing Cookies
I use a simple rule to add ";Secure" to the end of ever "Set-Cookie" header in a particular app server's response, and it works great for what it was originally intended to do.
when HTTP_RESPONSE {
set setcookie [HTTP::header "Set-Cookie"]
if { (not ($setcookie == "")) and (not ($setcookie contains ";Secure")) } {
HTTP::header replace Set-Cookie "$setcookie;Secure"
}
}
It occurred to me recently, though, that the "Set-Cookie" header can contain multiple cookies at once, separated by commas. What I need to do now is check whether a comma exists and add the text to each if there are more than one.
How can I segment out the header if commas exist, make the change when necessary, and reassemble it again?
- Shawn_Puckett_8
Nimbostratus
This seems to work on some of my cookies but not all, for example if I use Fiddler to look at the raw response I see: - Christopher_Fun
Nimbostratus
Thanks for posting your example, it has been quite helpful. - Shawn_Puckett_8
Nimbostratus
We ended up using a simple solution that seems to work for us: - Christopher_Fun
Nimbostratus
spuckett,
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