TJ_Vreugdenhil
Nov 20, 2015Cirrus
Rewrite and Redirect iRule v11 using Datagroup
We want to replace a specific string to a specific string but keep the whole remaining URI portion. For example, if original URI is https://qa.company.com/wps/portal/company/personal/banking/checking/index.html, We want to change it to https://qa.company.com/personal/banking/checking/index.html with respond with a 301. We also would like to use a datagroup for additional URI matching. Is there a way to accomplish this using the ProxyPass iRule?
I thought about using something like the following, would this be the best approach? How do I append the rest of the URI?
set httpuri [string tolower [HTTP::uri]]
Rewrite/Redirect
If "/wps/portal/company/personal" is found, “/wps/portal/company” will be removed and the URI becomes simply “/personal”
if {$httpuri starts_with "/wps/portal/company/personal"} {
set httpuri [string replace [HTTP::uri] 0 14]
HTTP::respond 301 https://[HTTP::header "host"]$httpuri
return
}