Forum Discussion
Daniel_Cheng_18
Nimbostratus
Apr 12, 2007Can't convert iRule by OTCU
We found the following iRule can't convert When we upgrade our BIGIP from v4.x to v9.x by OTCU.
if (http_uri matches_regex "/opscommon") {
log "*** client_addr: " + client_addr + ", uri: " + http_uri
redirect to "http://" + http_host + "/opsfop/" + substr(http_uri, 10, 1000)
}
else {
use pool OPS-PM
}
}
We are no experience on iRule, Any body can tech me how to convert this iRule to v9 ?
Many Thx.
Daniel
- hoolio
Cirrostratus
I think this should be functionally equivalent:if { [HTTP::uri] starts_with "/opscommon"}{ log local0. "client: [IP::client_addr], URI: [HTTP::uri]" HTTP::redirect "http://[HTTP::host]/opsfop/[HTTP::uri]" } else { pool OPS-PM }
- Daniel_Cheng_18
Nimbostratus
How About the "substr(http_uri, 10, 1000)" ?? - hoolio
Cirrostratus
Sorry about dropping that. You're trimming off the /opscommon/ from the requested URI using substring. To do that in 9.x you could replace /opscommon with /opsfop/ using 'string map', or use substr.if { [HTTP::uri] starts_with "/opscommon/"}{ log local0. "client: [IP::client_addr], original URI: [HTTP::uri], redirect URI: [string map {/opscommon/ /opsfop/} [HTTP::uri]]" HTTP::redirect "http://[HTTP::host][string map {/opscommon/ /opsfop/} [HTTP::uri]]" } else { pool OPS-PM }
- Daniel_Cheng_18
Nimbostratus
Thank you for help to convert our iRule to v9 format. Actually , I want to learn more about iRue.
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