Forum Discussion
Persistance based on session ID in URI
Hello!
Could you provide me some guidance of how to do this thing:
1. Client initiate session to server
2. Server create session for client and put in URI like www.example.com/blahblah!SessionID/blahblah
3. Client must be redirected to server according to sessionID in URI
I have configuration from apache that working and now need to rewrite it on irule:
stick-table type string len32 size 20k expire 60m store http_req_cnt
stick store-response hdr(E-Session)
stick match path_between(!,/)
server server1
server server2
So as i understand i need to do something like that:
when HTTP_RESPONSE {
if { match path between (!) and (/) for session id
set session_id matched session id
}
default {
set session_id ""
}
}
when HTTP_REQUEST {
if ( $session_id ne""}{
persist uie $session_id 3600
}
}
4 Replies
- Kevin_Stewart
Employee
Numbers 1 and 3 are pretty straight forward, but how will the URI present itself to the client in the response (2)? In the payload as (multiple?) links? A redirect? A header? A cookie? - scorpa_121336
Nimbostratus
That sessionID should be in response http header called - E-session. But the problem is - how to match path between two characters? - Kevin_Stewart
Employee
Ahh, well to extract a string from another string based on known delimiters, you may find the findstr function useful. ;)
So assuming the SessionID is in the URI:
set sessionid [findstr [HTTP::uri] "!" 1 "/"] - scorpa_121336
Nimbostratus
Oh, thank you! hope it will serve
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
* 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
