Forum Discussion
uie persistence
if the client has cookie and if client changes dynamicly ip address, i want persist this client
and if the client does not accept persistence or does not have cookie i want persist some parameter in uri
i try this solution but it didnt work
http://devcentral.f5.com/wiki/default.aspx/iRules/Weblogic_JSessionID_Persistence.html
what will be logic flow
if the client has cookie and if he changes ip address persist it
else
if the client does not have cookie or does not accept cookie, persist it' sessionid
http://somedomain.com/some/path?jsessionid=MYSESSIONID&someotherparam=FOOBAR
Could you please help me anybody
regards
zafer
12 Replies
- The_Bhattman
Nimbostratus
Hi Zafer,
Did you look into a Destination Affinity Persistance Profile?
/cb - zafer
Nimbostratus
why?
i dont load balance cache or firewall?
zafer - The_Bhattman
Nimbostratus
It's not necessary that you look at it that way. It's simply a way to bring the client comes back to persistance regardless of client IP Address.
You could also look into Hash persistence or Election based persistence (Click here)
/CB - hoolio
Cirrostratus
Again? (Click here). Could you try replying to your original posts if the topic is the same? It tends to waste time if you post the same question multiple times in different threads.
It sounds like you are wanting to insert your own session ID in response headers and content and then persist off of it if the client doesn't accept cookies. To do so, you'd need to parse the links in response headers (mainly the Location header for 30x responses) and all other responses with text payloads to insert a dynamically generated persistence token. On subsequent requests, you'd need to parse and remove the session token from the URI and persist based off of it.
It is technically possible to do this. I wrote a 1000 line iRule for a customer that implemented similar logic for encrypting/decrypting URI paths, but it's pretty complicated. I wouldn't recommend it for high traffic applications. Due to the complexity, I'd suggest any other solution first. And I don't think anyone here would be willing to write such a rule for you in their spare time.
For most applications, using cookie insert persistence with fall back source address persistence is enough. Does your user base really not accept cookies and have frequently changing source addresses?
Aaron - zafer
Nimbostratus
Hello
Sorry for again posts,
Aaron,
we have two type user group,
first group accept cookie and they change ip address dynamically
second group do'not accept cookie
i though we can do with irule an uie
if client comes without cookie add some session id for persistence
or if client comes with cookie persist them still they changes ip address
regards
Zafer - zafer
Nimbostratus
this irule solved my problem,
i want ask about timeout? what will be timeout for persistency records?
and when cliend hits the uri with same jsessionid the age starts again from "0" ?
regards
zafer
when CLIENT_ACCEPTED {
set add_persist 1
}
when HTTP_RESPONSE {
if { [HTTP::cookie exists "JSESSIONID"] and $add_persist } {
persist add uie [HTTP::cookie "JSESSIONID"]
set add_persist 0
}
}
when HTTP_REQUEST {
if { [HTTP::cookie exists "JSESSIONID"] } {
persist uie [HTTP::cookie "JSESSIONID"]
} else {
set jsess [findstr [HTTP::uri] "jsessionid" 11 ";"]
if { $jsess != "" } {
persist uie $jsess
}
}
} - hoolio
Cirrostratus
Hi Zafer,
It's good to hear that the rule is working for you.
Take a look at the notes in the codeshare example for details on the timeout (Click here)This iRule is intended to be applied under a Universal persistence profile configured with an appropriate timeout. If it is instead applied directly to a virtual server as a Resource, it must be modified to add a persistence timeout parameter to the "perist add" command.
So if you're not setting the persistence timeout using a UIE profile on the VIP, you can specify a timeout on the end of the 'persist add' line (Click here).
When a client request with an existing session ID is parsed, the timeout will be reset.
Aaron - zafer
Nimbostratus
Hi Aaron,
i have 2 questions;
i want make session persistence (like cookie insert method), it means i dont want set timeout value. what i need to do?
if i must set timeout value; what will be value? (how does it care tcp idle timeout)
last question for configuration this irule with uie profile, do i need show irule to uie profile or only setting values on uie profile and assing irule to vip, which one is correct or enough
regards
Zafer - hoolio
Cirrostratus
Hi Zafer,
If you define a "session" as the duration that a client keeps the browser open, the only way to maintain a persistence record for as long as (and only as long as) the session would be to use a session cookie (cookie with no expiration time) persistence profile. With cookie persistence you're telling the browser to send the persistence cookie for every request and to remove the cookie from memory once the browser is closed. You don't actually maintain a persistence record on the BIG-IP, so there isn't anything to maintain.
There isn't a way to mimic this behavior in non-cookie based persistence. You could set the persistence record with no timeout, but then the record would never be cleared from BIG-IP's memory. I would expect this would eventually result in a failure on the BIG-IP. It would be far better to specify a persistence timeout either in the 'persist add' command in the iRule, or if you want on a UIE persistence profile associated with the VIP. I don't know of any advantage in adding a UIE persistence profile to the VIP if you're already configuring the UIE persistence in an iRule. Maybe someone else has feedback on this?
Also, the TCP idle timeout is independent of the persistence timeout. The TCP layer doesn't impact how the persistence record is maintained.
Aaron - zafer
Nimbostratus
Hi Aaron,
i know session persistence on cookie , i want to know , is it possible to make it with uie ,
i thought it's not possible to make it , i need to set timeout values (it already worked)
thanks for informations
regards
ZAfer
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
