Forum Discussion
yruss972_100711
Nimbostratus
Dec 27, 2010visitor/session cookie without persistence
Hi,
I'm setting up a new Application Performance Monitoring appliance and although most of our traffic is session-less and stateless, we could get a lot of information if the APM appliance could identify traffic per visitor.
Rather than modify the applications, I thought I should be able to get the F5 to give each person a unique cookie on the first request that comes without a cookie- kind of like session persistence without the persistence?
Is there anyway to do this without an IRule? Maybe in an HTTP class or HTTP profile? Other possibilities?
Thanks,
Yonah
7 Replies
Sort By
- hoolio
Cirrostratus
Hi Yonah, - yruss972_100711
Nimbostratus
Hi, - hoolio
Cirrostratus
The only option I can think of is to use an iRule to generate a session ID and insert that into requests sent to the pool and in a cookie sent back to the client. You could potentially use one iRule and apply it to all of the virtual servers. - Chris_Miller
Altostratus
I'm with Aaron on an iRule being the only option I could come up with. Perhaps inserting a cookie/header with the value being some sort of combination of Client IP + Source Port + Time...that should be unique enough. The first part of the rule would check whether the cookie existed and if it did, would pass it through unadjusted. If it didn't exist, we'd insert it in the response. - hoolio
Cirrostratus
Client IP:port and current time in seconds for a session cookie value should be lightweight and collision proof. Nice idea Chris. - hoolio
Cirrostratus
Maybe something like this?when RULE_INIT { set static::session_cookie "my_session_cookie" } when HTTP_REQUEST { Check if cookie exists in request if {[HTTP::cookie $static::session_cookie] eq ""}{ set insert_cookie 1 } else { set insert_cookie 0 } } when HTTP_RESPONSE { Insert a cookie in the response if one wasn't present in the request. Use the client IP:port plus unixtime. Could use something random instead like an 8 digit psuedo random number: [format "%08d" [expr { int(100000000 * rand()) }]] if {$insert_cookie}{ HTTP::cookie insert name $static::session_cookie value "[IP::client_addr]_[TCP::client_port]_[clock seconds]" } }
- 74Grandville_29
Nimbostratus
Hoolio,
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