Forum Discussion
Blocking Traffic based on Geo Location
I have requirement to block the traffic to a particular https path (Page) via iRule on WAF device in order to restrict the access of below url from all other geo location aspect Thailand country .
Can someone help on this. I have write below iRule.
when HTTP_REQUEST {
if { [string tolower [HTTP::uri]] equals "http://abc.com/job-request/" && [whereis [IP::client_addr] country] ne "TH" } {
drop
}
{
else {
#log local0. "The page is restricted"
}
}
- spalandeNacreous
iRule looks fine with few modifcations to uri and closing braces. Also, please check with the requestor if it should be explicit URL "/job-request/" or wildcard (i.e anything after) "/job-request*".
If it's a wildcard, replace "eq" with "starts_with"
when HTTP_REQUEST { if { ([string tolower [HTTP::uri]] eq "/job-request") and ([whereis [IP::client_addr] country] ne "TH") } { drop } else { return } }
- JaspreetgurmAltocumulus
Thanks Sanjay for replying.
/"/job-request" is specific path which needs to be restricted. So could you please advise if eq is suffice the needs or shall this change to starts_with ?
- spalandeNacreous
yes. eq would be okay.
Recent Discussions
Related Content
* 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