Forum Discussion
hoolio
Cirrostratus
Jul 04, 2006Remove cookies from request using regex's
Hello,
I have a request to remove a set of cookies from requests before passing them on to ASM, using a set of regular expressions.
I believe that you can't use matchclass with a class of regex's. So I came up with the example below. Is there a more efficient way to remove the cookies?
class cookie_regex_class {
"cookie_name_one\w{8}"
"cookie_name_two-\w{10}"
"cookie_name_three"
}
rule delete_domain_cookies_rule {
expect cookie_regex_class to contain a list of regular expressions for cookie names
when HTTP_REQUEST {
log local0. "Cookies: [HTTP::cookie count] - [HTTP::cookie names]"
set cookies [HTTP::cookie names]
foreach aCookie $cookies {
log local0. "a cookie: $aCookie"
foreach aRegex $::cookie_regex_class {
if { [string tolower $aCookie] matches_regex $aRegex } {
log local0. "matched cookie: $aCookie with regex: $aRegex"
HTTP::cookie remove $aCookie
} else {
log local0. "didn't match cookie $aCookie with regex: $aRegex"
}
}
}
}
Thanks,
Aaron
No RepliesBe the first to reply
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