Forum Discussion
Chris_G_01_1415
Nimbostratus
Jul 03, 2014iRule to use specific HTTP profile
Hello,
I am trying to simplify some of our current configurations. Right now we are manually configuring each URL, like "xyzdev.com", to use a specific HTTP profile. We have multiple environments whi...
Kevin_Stewart
Employee
Jul 03, 2014You don't need to switch between HTTP profiles if you're just encrypting cookies. An iRule will do the job. Here's a variation of the HTTP cookie encryption article:
https://devcentral.f5.com/wiki/iRules.EncryptingCookies.ashx
when CLIENT_ACCEPTED {
set cookielist [list "USERID" "METRICS"]
set encryption_passphrase "abcd1234"
}
when HTTP_REQUEST {
foreach x [HTTP::cookie names] {
if { [lsearch $cookielist $x] ne "-1" } {
set decrypted [HTTP::cookie decrypt $x $encryption_passphrase]
if { $decrypted eq "" } {
HTTP::cookie remove $x
}
}
}
}
when HTTP_RESPONSE {
foreach x [HTTP::cookie names] {
if { [lsearch $cookielist $x] ne "-1" } {
HTTP::cookie encrypt $x $encryption_passphrase
}
}
}
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