Forum Discussion

Oscar_68814's avatar
Oscar_68814
Icon for Nimbostratus rankNimbostratus
Nov 27, 2008

Working Irules need a little Fine Tuning

I need some help please.

 

 

Our customer wants to have two features on their F5 setup.

 

 

A. Limit the connections to a virtual server to say for example 10,000 connections and if this number is exceeded to display a html page with a redirect meta link that will send user to a holding page

 

 

B. When customer wants to carry out maintenance work on their servers, they want a message to display such as site is down for maintenance.

 

 

a little bit of background first.

 

 

Customer is using cookie insert persistence due to their megaproxy, I have configured this no problem and each virtual server will have a http and https access method but using the same pool members.

 

 

Please see below the two irules I have configured for scenarios 1 and 2.

 

 

My questons are

 

 

1. Will this work for cookie insert persistence

 

2. How can I configure html content that can include color, meta links etc. I have tried but F5 code will not let me, I can only write simple html pages

 

 

Many thanks for your help.

 

 

 

1. Connections Limit

 

 

when RULE_INIT {

 

set ::total_active_clients 0

 

set ::max_active_clients 1}

 

when HTTP_REQUEST {

 

log local0. "HTTP connection limit rule triggered from [IP::remote_addr][TCP::remote_port] to Virtual Server [IP::local_addr][TCP::local_port]"

 

; If persistence cookie already exists,

 

; allow persistent connection without incrementing counter

 

if { [HTTP::cookie exists "BIGipServerseatwave"] } {

 

use pool xxxx.com

 

return

 

} else {

 

if { $::total_active_clients < $::max_active_clients } {

 

incr ::total_active_clients

 

use pool xxxx.com

 

return

 

; otherwise redirect

 

} else {

 

HTTP::redirect "http://www.xxxx.com/"

 

return

 

}

 

}

 

}

 

when CLIENT_CLOSED {

 

incr ::total_active_clients -1

 

 

}

 

 

 

 

 

 

 

2. Load Balancer Fail

 

 

when LB_FAILED

 

{HTTP::respond 503 content "

 

 

 

 

Site is down for Maintenance, Please try again later

 

 

Please update your links.

 

 

"

 

 

 

No RepliesBe the first to reply