Forum Discussion
nit8080_109161
Nimbostratus
Feb 01, 2008http_header("Authorization")
I need the iRule to set persistence based on the “Authorization” value in the HTTP header. On the old version 4 box, I did this by just putting
http_header("Authorization") in the expression field under pool properties.
This was working great.
On the version 9 box, I tried to get this same type of persistence by using an iRule associated to a UIE profile, and associating that profile to the VIP. The iRule I tried is:
The symptoms of the failure were that user sessions were being switched back and forth between the pool members instead of staying on the original server they were connected to. I have run a tcpdump and verified that the Authorization header is present. At this time we’re just using simple IP source persistence, but this could soon become a problem as a lot of users go through proxies and appear to come from the same IP.
when HTTP_REQUEST {
set authorization_id [HTTP::header value "Authorization"]
persist uie $authorization_id
}
- hoolio
Cirrostratus
Hello,when HTTP_REQUEST { if {[string length [HTTP::header value "Authorization"]]}{ persist uie [HTTP::header value "Authorization"] log local0. "[IP::client_addr] -> [HTTP::host][HTTP::uri] had Authorization header value: \ [HTTP::header value "Authorization"]" } }
- nit8080_109161
Nimbostratus
The symptoms of the failure were that user sessions were being switched back and forth between the pool members instead of staying on the original server they were connected to. I have run a tcpdump and verified that the Authorization header is present. At this time we’re just using simple IP source persistence, but this could soon become a problem as a lot of users go through proxies and appear to come from the same IP. - Deb_Allen_18Historic F5 AccountYou could try adding fallback persistence profile specifying simple/source address persistence to catch any instances in which the auth header is not consistent.
- hoolio
Cirrostratus
Good point, Deb. With just the UIE persistence, I would imagine that the client first makes a request without the credentials, so they'd get lumped together with all other clients who make such a request. Then when they make a new request with credentials, they'd get load balanced to a new member and get a new persistence record. Posted By hoolio on 02/04/2008 2:45 AM
when HTTP_REQUEST { if {[string length [HTTP::header value "Authorization"]]}{ persist uie [HTTP::header value "Authorization"] log local0. "[IP::client_addr] -> [HTTP::host][HTTP::uri] had Authorization header value: \ [HTTP::header value "Authorization"]" } }
- hoolio
Cirrostratus
As Deb suggested it would make sense to use source address persistence as a fallback method. If you're still seeing issues, then I'd still suggest using the same troubleshooting steps:when HTTP_REQUEST { log local0. "[IP::client_addr]:[TCP::port]: Request to [HTTP::host][HTTP::uri] had Auth header value: \ [HTTP::header value "Authorization"], with persistence record: [persist lookup uie [HTTP::header value "Authorization"]]" if {[string length [HTTP::header value "Authorization"]]}{ persist uie [HTTP::header value "Authorization"] } }
- Hi,
- hoolio
Cirrostratus
As you mention, HTTP::username is just parsed from the Authorization header by base64 decoding the value and splitting the user:pass on the colon. I'm not sure how using HTTP::username would work if using the full Authorization header wasn't working (assuming the user wasn't changing their password between every request). - We used something like this:
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