Forum Discussion
Tony2020
Nimbostratus
Jun 27, 2016Parse XFF header for Client IP and allow based on URI and DataGroup match
Hi Guys, I am trying to restrict access to certain URIs and looking at the XFF header (read/strip) from an iRule but having issue paring the IPs from XFF to make logical decision off of it. B...
Vijay_E
Cirrus
Jun 27, 2016I am using 2 datagroups - CLASS_RESTRICTED_URI is string datagroup with the 2 URI. CLASS_RFC1918 has the private address space (RFC1918).
Untested example that may answer your requirements:
when HTTP_REQUEST {
if { [class match [HTTP::uri] eq "CLASS_RESTRICTED_URI"] } {
if { ( not ([class match [IP::client_addr] eq "CLASS_RFC1918"])) } {
drop
} elseif { ([HTTP::header exists "X-Forwarded-For"]) and ([HTTP::header values X-Forwarded-For] ne "") and ([class match [HTTP::header "X-Forwarded-For"] eq "CLASS_RFC1918"]) } {
pool POOL_WEB_SERVERS
} else {
drop
}
}
}
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
