Forum Discussion
Bobby_Hood_3633
Nimbostratus
Jun 27, 2018Blocking URLs with certain characters
I'm trying to use an iRule to drop any connections to a web server that include the less-than or greater-than characters in the URL. This is what I have so far. "illegal_url_chars" is a data group li...
Stanislas_Piro2
Cumulonimbus
Jun 28, 2018Hi,
you can try this code:
when HTTP_REQUEST {
if { [string match {*[<>]*} [HTTP::uri]} {
log local0. "Detected illegal URL characters from [IP::client_addr]"
log local0. "[HTTP::request]"
TCP::close
drop
}
}
If the URI is encoded, you have to convert it before check
when HTTP_REQUEST {
set uri [URI::decode [HTTP::uri]]
if { [string match {*[<>]*} $uri} {
log local0. "Detected illegal URL characters from [IP::client_addr]"
log local0. "[HTTP::request]"
TCP::close
drop
}
}
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