Forum Discussion
felix001_29321
May 30, 2012Nimbostratus
Creating a HTTP session ID
Im looking for a way to create/insert a session id for each HTTP request that goes through the LB.
The insertion of the header will be straight forward but its the creation of the session ID im still trying to work out.
Is there any state information that I can use to build or create a session ID from ?
Thanks,
- Richard__HarlanHistoric F5 AccountThere is no direct way to get a session information from the LTM that I know of. But you can create your own session information from what the LTM has. But the question is what is the back end app? Can you create the session information based on what the APP passes.
- felix001_29321NimbostratusHi,
when HTTP_REQUEST { set id "[IP::client_addr][TCP::client_port][IP::local_addr][TCP::local_port][expr { int(100000000 * rand()) }]" binary scan [md5 $id] H* md5var junk HTTP::header insert X-ID $md5var }
- felix001_29321NimbostratusHi,
when HTTP_REQUEST { set id "[IP::client_addr][TCP::client_port][IP::local_addr][TCP::local_port][expr { int(100000000 * rand()) }]" binary scan [md5 $id] H* md5var junk HTTP::header insert X-ID $md5var }
- hoolioCirrostratus
Here are two options. The rand option should be more efficient but not cryptographically secure. You can compare the CPU usage using the timing command.
- hoolioCirrostratus...
- Richard__HarlanHistoric F5 AccountYou will want to put a if statement in the code that if the cookie is there do not gen a new one. This will keep the LTM for doing the session gen on each HTTP request and keep the session key the same for the transaction. The other thing to note the Cookie is a session based key by default you can add a timeout if you want.
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