Forum Discussion
Steve-S_87321
Nimbostratus
Aug 30, 2007I-rule to redirect using regular expression
Hello,
I need to know how to write an irule to redirect to a server using port 8080 if a keyword or regular expression is included in the uri. Without the keyword it should go to the same server with port 80.
Is there an irule already posted that fits this type of solution that I can edit ?
Thanks,
Steve
- hoolio
Cirrostratus
Hi Steve,if (http_uri starts_with "/some_uri"){ use pool port_80_pool } elseif (http_uri matches_regex "(?:some regex)"){ use pool port_8080_pool } else { use pool default_pool }
- Steve-S_87321
Nimbostratus
The following string is being used - - Steve-S_87321
Nimbostratus
- hoolio
Cirrostratus
Both rule are straightforward enough and should work. With the first rule, are you sure that the request is being sent to the wrong pool? Can you add logging to see?if (tolower(http_uri) contains "getimage") { log "matched: client" + client_addr + ":" + client_port + " " + http_host + http_uri use pool bscc.sysco.com-8080 } else { log "didn't match: client" + client_addr + ":" + client_port + " " + http_host + http_uri use pool bscc.sysco.com-80 }
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