Forum Discussion

Luca_55898's avatar
Luca_55898
Icon for Nimbostratus rankNimbostratus
Aug 18, 2011

http URL to HTTPS URL redirect with URI

I need to be able to redirect incomming requests on a HTTP URL to a HTTPS URL with URI.

 

 

So what that means is I need:

 

 

http://www.mysite.com to redirect to https://www.mysite.com/page1/login.html

 

 

I already have a HTTP and HTTPS VIP. The HTTP already redirects to HTTPS.

 

However i had to use some HTTP classes to redirect to different pools based on the URI.

 

 

How can i do this and maintain my existing HTTP class configs?

 

  • HTTP Vip

     

    HTTP class

     

    Redirect to https://[HTTP::host][HTTP::uri]

     

     

    HTTPS VIP

     

    Your existing classes.

     

     

    If you want to match anything on the HTTP VIP then put it above the http -> https class above.

     

     

    Kevin (Jarvil)
  • Sorry i don't quite understand.

     

     

    The HTTP to HTTPS redirect is working fine.

     

     

    What i need to do is redirect either http or https www.mysite.com to www.mysite.com/page1/logon.html

     

  • Then put a HTTP class as already shown on the HTTP VIP to redirect to HTTPS. Then on the HTTPS VIP, add HTTP class with a URI match for / and redirect to the URL you want.

     

     

    If you want iRules then on the HTTP VIP

     

     

    when HTTP_REQUEST {

     

    HTTP::redirect "https://[HTTP::host][HTTP::uri]"

     

    }

     

     

    then on the HTTPS VIP ...

     

     

    when HTTP_REQUEST {

     

    if { [HTTP::uri] equals "/" } {

     

    HTTP::redirect "https://[HTTP::host]/page1/logon.html"

     

    }

     

    }

     

     

    Classes are simpler to manage.

     

     

    Kevin (Jarvil)