Forum Discussion
gauravk
Nimbostratus
Jun 27, 2022Whitelist IP in F5 based on URL
Hi All, I have a public domain which is exposing several APIs and being accessed by many partners. This state should remain as-is. Now, there is another API which should only be accessed by IPs whi...
Mayur_Sutare
MVP
Jun 28, 2022Hi gauravk ,
You can try below iRule. Here "Allow-List" is a IP type of DataGroup.
when HTTP_REQUEST {
if {[HTTP::uri] eq "/path/to/api1"} {
if {![class match [IP::client_address] equals Allow-List]} {
HTTP::respond 403 content "<html><body>Access not permitted</body></html>" Connection Close
TCP::close
}
}
}
Hope it helps!
- gauravkJun 29, 2022
Nimbostratus
Thanks Mayur_Sutare
I will try this solution. May I know what is the difference between client_address and remote_addr. which one should be used ideally to get the client IP in order to be used in IP whitelisting.
Regards Gaurav
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)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
