I have a requrirment to allow access to a specific URI path from few public IPs & all private IPs; remaining public IPs should not be able to access this specific URI path. All other URI paths should be abe to be accessed by any IP whether private or public.
After creating a datagroup for private IP networks and public IPs, you can use iRule or LTM policy.
when HTTP_REQUEST {
if { [string tolower [HTTP::uri -normalized] equals "/good/evening/happy/life" && not ([class match [IP::client_addr] equals /Common/datagroupname])} {
drop
return
}
}
The iRule drops requests except certain IP addresses for the certain url. If there is no match with the if statement, requests will be forwarded to the default pool. iRule does not require any extra code.
It might be better to use path instead of uri.
when HTTP_REQUEST {
if { [string tolower [HTTP::path -normalized] equals "/good/evening/happy/life" && not ([class match [IP::client_addr] equals /Common/datagroupname])} {
drop
return
}
}