Forum Discussion
Frederic_Zeller
Nimbostratus
May 07, 2008Peristence on X-Forwarded-For
Hi.
Using Universal Persitence, it's quite easy to persist on a part of the URI. Many example can be found.
Like :
when HTTP_REQUEST {
persist uie [findstr [HTTP::uri] "user=" 5 "&"]
}
But I'd like to persit on one of the Header field (X-Forwarded-For)
Cookies can't be used due to multiple URL being used. ( part of the site is http, other part with different URL is https ).
Source address can't be used due to all client being behind a single proxy
Has anyone done any persitence on a header field ?
From the manual, I know it could be done, but how ?
Any Help would be greatly appreciated ..
TIA
Fred
2 Replies
- hoolio
Cirrostratus
Hi Fred,
You can replace '[findstr [HTTP::uri] "user-" 5 "&"]' with '[HTTP::header value X-Forwarded-Fo]'r. However, there might be multiple XFF header values in client requests. The HTTP::header command will return the last value. Proxies aren't required to insert an XFF header, so you wouldn't be guaranteed to get a valid value to persist off of. If the proxy in your scenario does insert an XFF header, the HTTP::header command should work for persisting off of the value.
Aaron - Frederic_Zeller
Nimbostratus
Hi Aaron
Just tested that :
when HTTP_REQUEST {
persist uie [HTTP::header "X-Forwarded-For"]
log local0. [HTTP::header "X-Forwarded-For"]
}
and it works great
Guess it will by the proxy responsability to insert the correct header ...
THANKS A LOT!
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
