Forum Discussion
Stanislas_Piro2
Jan 08, 2019Cumulonimbus
Hi,
the code provided by gscholz may work.
You can also try this code which check both host and path in 2 conditions instead of concatenate, then use string match with no case instead of equals for performance optimization according to this article, and finally respond with a 403 error page instead of reject.
when HTTP_REQUEST {
log local0. "Requested connection [HTTP::host][HTTP::path], converted [string tolower [HTTP::host][HTTP::path]]"
if {[string match -nocase "example.domain.com" [HTTP::host]] && [string match -nocase "/xyz/ab" [string trimright [HTTP::path]]]} {
log local0. "Rejected Connection [HTTP::host][HTTP::path], converted [string tolower [HTTP::host][HTTP::path]]"
HTTP::respond 403 content{request Forbidden}
}
}