Irule for an URI redirection
Hello All,
I have created an irule for an URI redirection and the expected flow as below:
1- Client to LB : https://www.domain1.com/resource1
2- LB to Client: Permanent URI redirection to an other URI value >> https://https://www.domain1.com/resource2
3- Client to LB: accessing the resource using the new URI >> https://https://www.domain1.com/resource2
Could you please look into the below script and correct if I would have missed anything and suggest me is there anyway I can do it better?
===========================================
when HTTP_REQUEST {
set NEW_URI "resource2"
switch -glob [string tolower [HTTP::uri]]
"/resource1"
{
HTTP::respond 301 Location "https://[HTTP::host][HTTP::uri]$NEW_URI"
}
}
============================================
Regards,
Thiyagu