iRule to redirect to a different url and change port from 80 to 443

Hello folks,

I am looking to combine to things with a iRule. Basically what i want is if a user comes to http://www.abc.com gets redirected to https://www.xyz.com. This is what i have so far:

when HTTP_REQUEST {

if { [HTTP::host] equals “www.abc.co” } {

HTTP::redirect “http://www.xyz.com[HTTP::uri]”

}

}

How do i do the http to https redirect within this same iRule?

Thanks!

Do the same thing, here is an example of how I do it:

when HTTP_REQUEST {
   set my_uri [HTTP::uri]
   set my_host [HTTP::host]
   set my_query [HTTP::query]
   if { $my_host equals "www.abc.co" } {
      HTTP::redirect "https://www.xyz.com$my_uri"
   } else {
      pool somepool
   }
}

Essentially all you need to do is use https in the redirect command.

maybe needless to say but after having the HTTP::redirect in place from http to https you obviously need a VS listing to 443 to take the redirected packages then.

schwiddy