problem with HTTP::redirect

Hi all, I am trying to do a redirect but I am getting a strange result. My code looks like this…

when HTTP_REQUEST {

if { ([HTTP::host] equals “abc.com”) and ([HTTP::uri] equals “/enroll”)} {

HTTP::redirect “.xyz Domain Names | Join Generation XYZ”

}

if { ([HTTP::host] equals “www.abc.com”) and ([HTTP::uri] equals “/enroll”)} {

HTTP::redirect “.xyz Domain Names | Join Generation XYZ”

}

}

But the result I am getting on the redirect is. (from httpwatch)

Redirect A redirect to http://abc.com/www.xyz.com/test/enrollment/home.aspx was issued by the server

I have also tried changing HTTP::redirect “.xyz Domain Names | Join Generation XYZ” to

HTTP::respond 301 Location “.xyz Domain Names | Join Generation XYZ”

but basically get the same thing. Any ideas why I keep getting the "abc.com before the URL I want to redirect to?

You need to specify a fully qualified URL in redirects in this situation. Else, the browser interprets the Location in the redirects as local and appends it to the current host. Can you try this?

when HTTP_REQUEST {

   switch [string tolower [HTTP::host]] {
      "abc.com" -
      "www.abc.com" {
          Request to abc.com or www.abc.com. Check for URI of /enroll
 if {[HTTP::uri] equals "/enroll"}{
            HTTP::redirect "http://www.xyz.com/test/enrollment/home.aspx"
         }
      }
   }
}

Aaron

Thanks Hoolio, I dont know how I missed that!