Forum Discussion
URL Distribution
- Mar 26, 2024
Not at all tested or optimized or secured against injection with the table commands, but to get the juices flowing I threw this together. Not 100% confident it'll work and I don't have time until end of the week to flesh out and test, but it is possible to achieve what you're after. That said, it'll be a support nightmare to grow with the needs of the business since it's not a well-defined problem or scale, so I would push back against this particular ask.
when HTTP_REQUEST priority 500 { if { [string tolower [HTTP::path]] == "/form"} { foreach form [list form1 form2 form3 form4 form5 form6] { if { [table lookup $form] < 50 } { table incr $form 1 HTTP::uri /$form set current_form $form break } } } } when HTTP_REQUEST priority 501 { if { [string tolower [HTTP::path]] == "/form" } { HTTP::respond 429 content "<html><body><p>All forms at max of 50 requests</p></body></html>" } } when HTTP_RESPONSE { table incr $current_form -1 }
Hi JRahm!
Thanks for the reply and the heads-up on the example. At this point the number of forms will be static, but of course as the business needs, that could change in the future. Yes, as the connections bleed from the forms new requests can be sent to them.
Not at all tested or optimized or secured against injection with the table commands, but to get the juices flowing I threw this together. Not 100% confident it'll work and I don't have time until end of the week to flesh out and test, but it is possible to achieve what you're after. That said, it'll be a support nightmare to grow with the needs of the business since it's not a well-defined problem or scale, so I would push back against this particular ask.
when HTTP_REQUEST priority 500 {
if { [string tolower [HTTP::path]] == "/form"} {
foreach form [list form1 form2 form3 form4 form5 form6] {
if { [table lookup $form] < 50 } {
table incr $form 1
HTTP::uri /$form
set current_form $form
break
}
}
}
}
when HTTP_REQUEST priority 501 {
if { [string tolower [HTTP::path]] == "/form" } {
HTTP::respond 429 content "<html><body><p>All forms at max of 50 requests</p></body></html>"
}
}
when HTTP_RESPONSE {
table incr $current_form -1
}
- walkman69Mar 26, 2024Altostratus
Thanks JRahm! I think this is a good enough jumping off point. I greatly appreciate it. I firmly believe the F5 is not he right place for what they are trying to do, but they asked. I will definitely advise against it.
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