Forum Discussion
iRule for matching source-ip OR true-client-ip from a datagroup
Hi experts, Need help in writing an iRule that has the following logic -
Request is allowed only if the source-ip OR true-client-ip present in the header (if the request comes via a proxy) are part of a datagroup called "Allowed-ips". Else is dropped.
when HTTP_REQUEST { if { [class match [IP::client_addr] OR [HTTP::header "True-Client-IP"] equals "Allowed-ips" ] }{ Do not interfere (Allowed)
} else {
drop
} } }
This gives me an error for wrong argument. What am i missing, please advise?
2 Replies
- Vijay_E
Cirrus
when HTTP_REQUEST { if { ([class match [IP::client_addr] equals Allowed-ips]) or ([class match [HTTP::header "True-Client-IP"] equals Allowed-ips]) } { Do not interfere (Allowed) } else { drop } }Untested - give it a shot !
Also, you need to replace this
with pool information, if you want the traffic to go to a specific pool.Do not interfere (Allowed) Hi,
A class match was missing in the if condition :
when HTTP_REQUEST { if { ([class match [IP::client_addr] equals Allowed-ips]) or ([HTTP::header exists "True-Client-IP"] and [class match [HTTP::header "True-Client-IP"] equals Allowed-ips]) } { Do not interfere (Allowed) } else { drop } }
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
* 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