Forum Discussion
Steve_Brown_882
Sep 12, 2007Historic F5 Account
Help with Persit Irule
Hello All,
I have been working on rule that uses a unique x-forwarded-for header to persit traffic.
My orginal rule (below) works fine however when a customer hits the VIP that does not have the "X-Netli-Forwarded-For" header the traffic fails.
when HTTP_REQUEST {
set xff_addr [HTTP::header "X-Netli-Forwarded-For"]
persist uie $xff_addr
}
So I created this irule (below) instead of the first one, however this seem to cause me to recieve 500 errors from my app server so I think it is breaking the request some how.
when HTTP_REQUEST {
if { [HTTP::header exists "X-Netli-Forwarded-For"] } {
set persit_addr [HTTP::header "X-Netli-Forwarded-For"]
} else {set persit_addr [IP::client_addr]}
persist uie $persist_addr
}
Any Thoughts on this?
1 Reply
- hoolio
Cirrostratus
There is a typo in your rule with "persit". You should actually see a TCL error in /var/log/ltm stating the $persist_addr variable doesn't exist.
With that updated, and a specified timeout, the rule should work as expected:when HTTP_REQUEST { if { [HTTP::header exists "X-Netli-Forwarded-For"] } { set persist_addr [HTTP::header "X-Netli-Forwarded-For"] } else { set persist_addr [IP::client_addr] } persist uie $persist_addr 600 }
You can view the current persistence records with the following command:
watch -n1 'b persist show all'
Each time the rule is triggered and there is an existing persistence record, you should see the age timer reset to 0.
By default, on 9.2.4, it looks like (uie) persistence records are timed out after 180 seconds (without any type of persistence profile applied to the VIP). You or your app may expect persistence to be maintained for longer than the default time so you could explicitly specify the timeout.
Aaron
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