Forum Discussion
JP_42120
Nimbostratus
Dec 02, 2014Trying to add more restrictions to exiting iRule with flags
Hi, we are trying to additional restrictions based on new IP and URL to existing rule... Below is an example of our current and also NEW iRule. does this look right? is there a better way to do th...
Brad_Parker
Cirrus
Dec 02, 2014Try something like below. It should be less complicated and more efficient.
when HTTP_REQUEST { if { [HTTP::host] starts_with "foo.com" } {
If URI start with /gel/ or /water/ validate allowed IP and send it to the pool or redirect
if { [HTTP::uri] starts_with "/gel/" || [HTTP::uri] equals "/water/" } {
if { [class match [IP::client_addr] equals allow_address_data_group ] } {
pool secure_80_pool
}
else {
HTTP::redirect "http://deafult-internal.net"
}
}
If URI start with /new-URIr/ validate allowed IP and send it to the pool or redirect
elseif { [HTTP::uri] starts_with "/new-URI/" } {
if { [class match [IP::client_addr] equals new_allow_address_data_group ] } {
pool secure_80_pool
}
else {
HTTP::redirect "http://deafult-internal.net"
}
}
Redirect all other URI
else {
HTTP::redirect "http://www.default-external"
}
}
Brad_Parker
Cirrus
Dec 02, 2014Missed a bracket
when HTTP_REQUEST {
if { [HTTP::host] starts_with "foo.com" } {
If URI start with /gel/ or /water/ validate allowed IP and send it to the pool or redirect
if { [HTTP::uri] starts_with "/gel/" || [HTTP::uri] equals "/water/" } {
if { [class match [IP::client_addr] equals allow_address_data_group ] } {
pool secure_80_pool
}
else {
HTTP::redirect "http://deafult-internal.net"
}
}
If URI start with /new-URIr/ validate allowed IP and send it to the pool or redirect
elseif { [HTTP::uri] starts_with "/new-URI/" } {
if { [class match [IP::client_addr] equals new_allow_address_data_group ] } {
pool secure_80_pool
}
else {
HTTP::redirect "http://deafult-internal.net"
}
}
Redirect all other URI
else {
HTTP::redirect "http://www.default-external"
}
}
}
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