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_139
Nacreous
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_139Dec 02, 2014
Nacreous
Missed 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" } } } - JP_42120Dec 02, 2014
Nimbostratus
Hi Brad, thank you. I will try this format. We actually have 10+ URIs in the first filter. I guess it would look like below if we needed to add more. (I'm still new with iRules) :D adding additional URI's in the filter if { [HTTP::uri] starts_with "/gel/" || [HTTP::uri] equals "/water/" || [HTTP::uri] equals "/dirt/" || [HTTP::uri] equals "/sky/ || [HTTP::uri] equals "/etc/"................}
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