Forum Discussion
HTTP redirect if connections per pool member exceed a threshold with tables
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.
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
- John_Alam_45640Historic F5 Account
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 - Rama_75068Nimbostratus
Hi Franco, Are you able to make the iRule work with the HTTP Page redirected, when connection limit is reached at the pool?
- JUAN_MANUEL1Nimbostratus
Another solution:
use
pool null_pool (instead of reject)
Then, create a http profile with fallback host --> redirected_url (http[s]://.....)
Recent Discussions
Related Content
* 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