Forum Discussion
DifanZ
Cirrus
Jul 13, 2021irule for extracting a string from a URI
Hi experts, I am new to irule and it doesn't look like I am allowed much time to learn it properly... In short, they want me to redirect to a URL when all the members in the pool are down. The probl...
spalande
Nacreous
Jul 14, 2021You can try below.
when HTTP_REQUEST {
if { ([string tolower [HTTP::uri]] starts_with "/ecmlivelink/llisapi.dll/open") and ([active_members livelink_qut_tcp_8100_pool] == 0) } {
set doc_id [string range [HTTP::uri] 30 end]
HTTP::respond 301 Location "http://csintqut.network.qut:81/fsl/Redirect.aspx?docid=$doc_id"
return
}
}- DifanZJul 15, 2021
Cirrus
Thanks Sanjay. The length might be dynamic and there could be at least a slash at the end of the link.. I actually opened a case and I am provided with a regular expression code like this
regexp "/open/(\[0-9\]+" $uri something doc_id
This successfully got me the number, regardless of the pending characters. But thanks anyway for your help!
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