Forum Discussion
Bubbagump_12531
Nimbostratus
Dec 05, 2012Drop or send to pool based on source IP AND host address
I am trying to emulate the ability in Apache to accept or drop traffic to a particular vhost based on IP. So for instance, my Apache's vhost config says:
Order deny,allow
Deny from All...
Bubbagump_12531
Nimbostratus
Dec 05, 2012That worked. Excellent. now I am stuck on part two of this.
I only want this iRule to apply to requests with that host there fore I added an extra else if
when HTTP_REQUEST {
if { ([HTTP::host] matches "myapp.somehost.com") and [class match [IP::client_addr] equals localnets]} {
pool /Common/pool_ruby_http
} elseif { ([HTTP::host] matches "myapp.somehost.com") and [class match [IP::client_addr] equals not localnets]} {
discard
}
}
I can find all sorts of documentation on how to make positive logic, but not negative.... thus I am just guessing on combinations of 'not equals', !equals etc and seeming to not get anywhere.
EDIT: I think I got it
when HTTP_REQUEST {
if { ([HTTP::host] matches "myapp.somehost.com") and [class match [IP::client_addr] equals localnets]} {
pool /Common/pool_ruby_http
} elseif { ([HTTP::host] matches "myapp.somehost.com") and not [class match [IP::client_addr] equals localnets]} {
discard
}
}
Am I right?
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
