Forum Discussion
Chris_Miller
Altostratus
May 13, 2010Reject Traffic Unless Client has Certain Header or Client-IP
I'm looking for iRule assistance again! I'm handling traffic that comes through Akamai for a staging environment. Because this environment is staging, yet requires internet access, we only want traffic that was sent through Akamai to get to us. Since Akamai inserts a "True-Client-IP" header, I want to allow traffic with that header through. Since our internal users have to test the site without going through Akamai, I want to allow them through as well.
So, if a user doesn't have the True-Client-IP header or a source of 1.1.1.1, they should get rejected.
Here's what I've pieced together:
when HTTP_REQUEST {
if { not ([HTTP::header exists "True-Client-IP"]) }
else
I get confused here, since we aren't in the client_accepted event, can I still use source IP? Also, I want to allow a 24-bit space, 1.1.1.0, how do I represent that?- Michael_Yates
Nimbostratus
Try this and see if it works out for you. I did something similar for a Maintenance Override Page.when HTTP_REQUEST { if { !([HTTP::header exists "True-Client-IP"]) or !([matchclass [IP::remote_addr] equals $::ListOfPeoplesIPAddresses]) } { reject } }
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