Forum Discussion
ITNINJAWARROIOR
Apr 23, 2019Nimbostratus
iRule to drop connection of invalid host header
I have an issue creating an iRule. I need the iRule to drop the connection at the F5 if the host header is manipulated. I have tried some iRules in Test but the syntax is apparently not correct.
Kai_Wilke
Apr 23, 2019MVP
Hi ITNINJAWARROIOR,
try the iRule to allow just a few selected HOST-header values to pass through...
when HTTP_REQUEST {
switch -exact -- [string tolower [HTTP::host]] {
"www.domain.de" -
"www.domain.fr" -
"www.domain.com" {
Do nothing for white listed HOST-header values...
}
default {
Send 502 response for reuqests with unknown HOST-headers...
HTTP::respond 502 content "Bad Gateway" "Content-Type" "text/html" "Connection" "close"
}
}
}
Cheers, Kai
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