Forum Discussion
Greenberg
Nimbostratus
Mar 08, 2012iRule to Limit Connections from Source IP to Destination IP
Guys,
Novice to iRules brings himself before you.
I've been given a requirement to Limit the number of Connections from a number of Source Hosts to a Destination.
This ...
Greenberg
Nimbostratus
Mar 12, 2012Hi Aaron,
It's Apache on a Linux Based Web Server.
This is another blast I had at the iRule:-
when RULE_INIT {
set static::max_connections_pi 2
set ::Inpicall =0
set static::active_connections_pi 0
}
when HTTP_REQUEST {
if { [HTTP::uri] contains "URI" } {
set inpicall=1;
incr ::active_connections_pi 1
if { not [HTTP::cookie exists "inpicheckout"] and $::active_connections_pi > $::max_connections_pi} {
HTTP::respond 302 Location "Website.html" "Connection" "Close" "Cache-Control" "no-cache" "Pragma" "no-cache" TCP::close
}
}
}
when HTTP_RESPONSE {
if $Inpicall==1
{ incr ::active_connections_pi -1
$Inpicall=0
}
}
when CLIENT_CLOSED { if $inpicall==1 { incr ::active_connections_pi -1 $Inpicall=0
}
}
Would this only max connections for traffic hitting the URI or all Connections hitting the Virtual Server?
Chris.
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
