Irule simple redirect or not?
I have an issue where I think I need a redirect but I'm not sure
I have a site http://www.testsite.com that is in production and I can't modify the vs at this time. When users type www.testsite.com in the browser they get to the site fine, but when they type in the browser http://testsite.com I get a 404.
So, because I can't modify the current vs at this time I have created a new vs on my ltm and am trying to create an irule that redirects to the prod vs, if this is not the correct thing to do could someone help with the correct option, redirect, insert www or something else.
I have tried the following rules
when HTTP_REQUEST {
if { [HTTP::host] eq "http://testsite.com" } {
HTTP::redirect "http://www.testsite.com"
}
}
when HTTP_REQUEST {
if { [HTTP::host] equals "testsite.com" }{
HTTP::header replace Host "www.testsite.com"
}
}
I even tried this
when HTTP_RESPONSE {
if { [HTTP::status] == 404} {
HTTP::redirect "http://www.testsite.com"
}
}
or am I way off because non of the above seem to do what I need.