Forum Discussion
kgaigl
Cirrocumulus
Oct 20, 2025IRule to block different combinations host/uri
hello together, we've got a VIP with a lot of CNAME's and a few login-URI's should be blocked, but not all. so in our Irule we have some Entries like: elseif { [HTTP::uri] starts_with "/presse/l...
Injeyan_Kostas
Nacreous
Oct 20, 2025hi kgaigl​
yes you can use [HTTP::host] for https too
You should though better use switch instead of if
check this https://clouddocs.f5.com/api/irules/switch.html
and this is an example
when HTTP_REQUEST
{
switch -- [string tolower [HTTP::host]]
{
"www.example.com" -
"test.example.com"
{
switch -glob -- [string tolower [HTTP::path]]
{
"/presse/login*"
{
HTTP::respond 403
}
}
default
{
log local0. "Hit default for [HTTP::path]]"
}
}
"abc.example.com"
{
log local0. "Hit rule for [HTTP::host]]"
}
default
{
log local0. "Hit default for [HTTP::host]]"
}
}
}
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