iRule redirect but need some of the original PATH
Relatively new to iRules but have done a ton of scripting (PoSh, vbs, etc...) and understand the basics and have studied the http::uri, http::path and http::query built-in variables - thanks in advance for your assistance!
I have an incoming URL like "https://www.mycompany.com/management/dept/eng/corporatecommunications/Shared%20Documents/Mine.docx?OpenDocument"
The query parameter (OpenDocument) may or may not exist - need to plan for both.
I need the redirect URI to be: "https://www.mycompany.com/sites/corpcomm/Shared%20Documents/Mine.docx?OpenDocument"
I don't have a BIGIP to test with so I've built a few PoSh functions to create the http::uri, http::path, etc... variables to work against a string - not apples to apples but is shedding light on my problem.
I feel like I should be able to capture "/Shared%20Documents/Mine.docx?OpenDocument" in a couple of variables but uri::path depth isn't easy to replicate in PoSH. "/Shared%20Documents/" could be another layer or two or six deep - the text itself is just an example.
This is one scenario of many to follow with the same basic convention - we're using a switch statement now: switch -glob [string tolower [HTTP::uri]] but we are open to suggestions...
Thanks!