Forum Discussion
FFX2014_23725
Nimbostratus
Apr 02, 2013iRule to allow private IP and reject public IP
I am new to using iRules. What I’m looking to do is to restrict a page to only be accessible from a private IP address range, and reject connections from all public IP addresses.
I used the rule below that I found on this forum, however it didn't work 100%. It was successful in allowing private address and restricting public address, however the VIP that is using this rule is hosting multiple websites. When using this rule the restriction is set on all websites, not the one I specifically need it for. How can I modify this to address the issue?
when HTTP_REQUEST {
if { [HTTP::host] equals "www.website.com" and ([matchclass [IP::remote_addr] equals $::PoolOfAllowedAddresses ]) } {
pool poolofallowedservers
}
else {
reject
}
}
1 Reply
- Chris_Phillips
Nimbostratus
you should just need a slilght change in logic:when HTTP_REQUEST { if { [HTTP::host] equals "www.website.com" and ! ([matchclass [IP::remote_addr] equals $::PoolOfAllowedAddresses ]) } { reject } else { pool poolofallowedservers } }
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