Forum Discussion
Session Persistence based on http header value using iRule
- Sep 16, 2021
when HTTP_RESPONSE {
if { [HTTP::header exists "X-Token"] } {
if { [HTTP::header "X-Token"] != "" } {
persist add uie [HTTP::header "X-Token"]
}
}
}
when HTTP_REQUEST {
if { [HTTP::header exists "X-Auth-Token"] } {
set value [persist lookup uie [HTTP::header "X-Auth-Token"]]
log local0. "value is $value"
if { $value != "" } {
persist uie [HTTP::header "X-Auth-Token"]
}
}
}
Hi Mohanad,
Your irule seems correct. Maybe you can add a fallback persistence in an else condition.
According to the article (Overview of universal persistence (f5.com), in addition to your irule, you should also create a universal persistence profile as follows:
To create a universal persistence profile and reference the persistence iRule you created in the previous procedure, perform the following procedure:
- Log in to the Configuration utility.
- Navigate to Local Traffic > Profiles.
- From the Persistence menu, click Create.
- Type a name for the universal persistence profile.
- For Persistence, click Universal.
- For Configuration, select the iRule check box, then click the persistence iRule you created.
- Click Finished.
Thank you Oguzy, i know this requires persistence profile
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