Forum Discussion
iRule 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 which use different HTTP profiles we have configured. I was thinking of creating an iRule that can match "xyzdev.com" in the URL then use this specific HTTPdev profile or "xyztest.com" to use the HTTP test profile. Anyone know if that is possible using iRules or can anyone suggest a better way?
4 Replies
- shaggy
Nimbostratus
What type of customizations/differences do you have among the custom http profiles?
- Chris_G_01_1415
Nimbostratus
The only thing that I can tell is different is the urls that get encrypted cookies. Under our dev http profile, encrypt cookies field, we have 10 urs, like dev1, dev2, dev3, etc. We have the same for test and stage. I guess I am just trying to figure out is if there is a much simpler way to configure this rather than manually add a URL to the encrypt cookies field each time a new one is created.
- Kevin_Stewart
Employee
You 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 } } } - Chris_G_01_1415
Nimbostratus
Thanks for your help Kevin. I am still in the process of testing this.
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
* 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