Forum Discussion
Haroonh
Jun 20, 2020Nimbostratus
Allowing access only to specified directories (HTTP::PATH) on hosts using IRULES
Hi Community, I am a beginner in F5 and would like your help in achieving the following would like to restrict the traffic to only to the following path(s) http://hostname.mylab.co...
PeteWhite
Employee
when HTTP_REQUEST {
if { [HTTP::host] == "hostname.mylab.com" } {
switch -- [HTTP::path] {
"/dir1" -
"/dir2" -
"/dir3" -
"/dir4" -
default { drop }
}
} else {
drop
}
}
Haroonh
Jun 23, 2020Nimbostratus
Thanks Pete for the reply and your time, really appreciate it.
I have tried your solution but it doesn't seem to work,
I implemented the following which went fine.
when HTTP_REQUEST {
if { (([HTTP::host] eq "hostname.mylab.com") and ([HTTP::uri] contains "/dir1"))
or (([HTTP::host] eq "hostname.mylab.com") and ([HTTP::uri] contains "/dir2"))
or (([HTTP::host] eq "hostname.mylab.com") and ([HTTP::uri] contains "/dir3"))
or (([HTTP::host] eq "hostname.mylab.com") and ([HTTP::uri] contains "/dir4")) } {
} else {
drop
}
}
Kind Regards,
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