Forum Discussion
Juerg_Wiesmann
Nimbostratus
Jun 04, 2007Waiting Room
Hi Experts
Have got a difficult Question.
We want to have to send 1000 Sessions to our pool Ticket.
Users 1001-2000 should be redirected to a Waiting Room to get somthing like...
Juerg_Wiesmann
Nimbostratus
May 25, 2009I updated my Waiting iRule. The only Problem still exists is that the client close appears also when browser was not closed.
Any help appreciated.
Jürg
when RULE_INIT {
set ::total_active_clients 0
set static::max_active_clients 3
set ::ticket_number 0
set ::next_please 3
set ::howlong 3
log local0. "rule session_limit initialized: total/max: $::total_active_clients/$static::max_active_clients/$::ticket_number"
}
when HTTP_REQUEST {
test client-ID Cookie availability
if {[HTTP::cookie exists "ClientID"]} {
Client-ID Cookie exists (don't need one )
if ClientID cookie is in the request the client is directly sent to the TicketServer
set need_cookie 0
set client_id [HTTP::cookie "ClientID"]
log local0. "ClientID Exists = $::total_active_clients/$static::max_active_clients/$::ticket_number"
log local0. "We have a ClientID and the need cookie value is....$need_cookie and we will return now"
return
}
if {[HTTP::cookie exists "ticket"]} {
HTTP::cookie decrypt ticket DEQREddarehf "256"
ticket Cookie exists --don't need one--
log local0. "We have a Cookie named ticket and the ticket number is: $::ticket_number"
log local0. "Cookie ticket Exists = $::ticket_number / $::next_please"
if {$::ticket_number <= $::next_please} {
If ticket_number is lower than next_please
if {$::total_active_clients < $static::max_active_clients} {
set need_cookie 1
set client_id [string range [AES::key 128] 8 end]
incr ::total_active_clients 1
log local0. "Ask for new ClientID Cookie $::total_active_clients/$static::max_active_clients/$::ticket_number"
}}
else {
HTTP::respond 200 content {
Sorry
The System was closed due to high demand. Please wait a few seconds we will try to connect you shortly
}
}}
if {not [HTTP::cookie exists "ticket"]} {
incr ::ticket_number 1
set ticket_number [HTTP::cookie "ticket"]
log local0. "Cookie ticket Needed = $::ticket_number"
HTTP::respond 302 Location "http://[HTTP::host][HTTP::uri]" "Set-Cookie" ticket=$::ticket_number
}}
when HTTP_RESPONSE {
if {$need_cookie == 1} {
HTTP::cookie insert name "ClientID" value $client_id
log local0. "We insert the ClientID Cookie"
}
else {
log local0. "need cookie is.. $need_cookie"
HTTP::cookie insert name "ticket" value $::ticket_number
HTTP::cookie encrypt ticket DEQREddarehf "256"
}
}
when CLIENT_CLOSED {
decrement current connection counter for this client_id
if {$::total_active_clients > 0} {
incr ::total_active_clients -1
log local0. "ClientClosed $::total_active_clients"
}
else {
set ::ticket_number 0
set ::next_please 3
log local0. "ticketReset= $::ticket_number/$::next_please" }}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