H_Y
Jun 25, 2020Nimbostratus
Redirect with modified Host and URI from variable
Hello, I am very new to iRules and facing an issue while trying to redirect based on the below scenario.
Trying to achieve HTTPS://mydomain1.com/"clientname" to HTTPS://demo-"clientname".mydomain2.com/"clientname"
Tried below iRule but it is not redirecting, it stays on initial request in browser.
when HTTP_REQUEST {
if { [class match [string tolower [getfield [HTTP::uri] "/" 2]] equals clientnames_dg] } {
set clientname [getfield [HTTP::uri] "/" 2] } {
HTTP::respond 301 "Location" "https://demo-${clientname}.mydomain2.com/demo-${clientname}"
}
}