Forum Discussion
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
}
}
- JaspreetgurmJul 15, 2021
Altocumulus
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 ?
- Sanjay_PalandeJul 15, 2021
Nacreous
yes. eq would be okay.
- JaspreetgurmJul 16, 2021
Altocumulus
I am allowing traffic only TH country, so I believe the action should be allow and else should be drop like below
{
allow
} else { drop
}
}
- Sanjay_PalandeJul 16, 2021
Nacreous
Since your iRule has use "ne" (not equal) operator for checking the Country, it's dropping on first condition. You can modify the operator to check just for TH country using "eq" operator to drop on else condition. Both should be fine.