20-Mar-2014
05:19
- last edited on
02-Jun-2023
15:08
by
JimmyPackets
Hi.
I´m taking a view to a lot of devcentral documents, and tables are getting me crazy.
I´m interested to get the following behavior. We want to limit the number of connections to our load balanced severs to 500 TCP connections in one of our vservers. If TCP connections per pool member reach that threshold (all of them are owning 500 TCP connections), an HTTP redirect to sorry server has to be send to client.
I think I could use one irule like this to limit the number of TCP connections per pool member because our system is CMP:
when CLIENT_ACCEPTED {
set key "[IP::client_addr]:[TCP::client_port]"
}
when LB_SELECTED {
set tbl "connlimit:[LB::server]"
table set -subtable $tbl $key "ignored" 180
if { [table keys -subtable $tbl -count] > 5 } {
table delete -subtable $tbl $key
event CLIENT_CLOSED disable
reject
} else {
set timer [after 60000 -periodic { table lookup -subtable $tbl $key }]
}
}
when CLIENT_CLOSED {
after cancel $timer
table delete -subtable $tbl $key
}
The question is, i don´t know how to proceed with HTTP redirection if this irule is managed when HTTP_REQUEST event is not launched.
Have i to use this irule to control TCP connection limit per pool member?? How could I manage HTTP redirection if TCP connection limit is managed before to HTTP Request??
Thanks.
Solved! Go to Solution.
20-Mar-2014
07:46
- last edited on
02-Jun-2023
15:08
by
JimmyPackets
Good question.
use:
TCP::respond "HTTP/1.1 302 Temporarily Moved\r\nLocation: http://moved.com/here/\r\n\r\n"
See this page for more examples:
https://devcentral.f5.com/wiki/iRules.TCP__respond.ashx
20-Mar-2014
07:46
- last edited on
02-Jun-2023
15:08
by
JimmyPackets
Good question.
use:
TCP::respond "HTTP/1.1 302 Temporarily Moved\r\nLocation: http://moved.com/here/\r\n\r\n"
See this page for more examples:
https://devcentral.f5.com/wiki/iRules.TCP__respond.ashx10-Dec-2016 06:31
Hi Franco, Are you able to make the iRule work with the HTTP Page redirected, when connection limit is reached at the pool?
22-Apr-2020 11:03
Another solution:
use
pool null_pool (instead of reject)
Then, create a http profile with fallback host --> redirected_url (http[s]://.....)