Forum Discussion
cmautner_16848
Nimbostratus
Apr 09, 2008Quick question concerning active sessions
I'm looking for code which will determine if all servers are disabled AND no active sessions are in place. I know the active_members command is working properly. I'm having trouble finding an active sessions command.
My goal is to have new attempts to connect redirected to a maintenance page, but active sessions remain active until they disconnect. Any help is appreciated!
when HTTP_REQUEST {
if {[active_members MYPOOL] == 0 && ????[active_connections/sessions] == 0} {
HTTP::redirect "http://www.google.com"
}
}4 Replies
- Colin_Walker_12Historic F5 AccountSince there isn't currently a command to view the number of active sessions, or to tell if a request coming in is from a currently active session, the best way to go about this would be to tag all incoming requests somehow (a cookie perhaps?) after you've checked to see if there are any active members.
That would look something like this:when HTTP_REQUEST { if { [HTTP::cookie exists MYCOOKIE] } { pool MYPOOL } else { if { [active_members MYPOOL] == 0 } { HTTP::redirect "http://www.google.com" } else { HTTP::cookie insert MYCOOKIE ... pool MYPOOL } } }
Effectively what that says is:
If the custom cookie exists, send to pool regardless of pool status.
If the custom cookie does not exist, check the pool status. If there are no members available, redirect to google. If there are, set the cookie and send them to the pool.
Is that what you're trying to accomplish?
Also - can I ask why you'd want to allow active sessions to try and connect when there are no servers available?
HTH,
Colin - cmautner_16848
Nimbostratus
We have a form that can take 30-45 minutes to fill out, so when we bring the site down for maintenance, we want to let the existing connections finish, while new connections are brought to a "sorry we're down" page. - Nicolas_Menant
Employee
when you disable a pool members it maintains by default the active and persisted connections.
So if you configure an HTTP profile with a fallback host and you disable all the pool members you should have what you are looking for - cmautner_16848
Nimbostratus
Nmenant! THATS AWESOME!
That is exactly what we need, and it was really easy to do! thanks!
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)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
