Forum Discussion

Dbow_21284's avatar
Dbow_21284
Icon for Nimbostratus rankNimbostratus
Apr 26, 2010

Need to Redirect HTTPS Request to Another HTTPS Request

Hello,

 

 

I need to do the following:

 

 

Redirect https://www.whatever.com to https://www.suntin-else.com ... I cannot find an iRule to do this. It is easy to do the HTTP to HTTPS, but I could not find a way in the forums to do what I need to do.

 

 

I do have a clientssl profile on my virtual server if that will help. Please help.

 

 

I could just create a site in IIS with the old domain name and cert and make it an absolute redirection to the new site .... however, I want to figure this out!

 

Any ideas?

 

 

thanks

 

 

Dave

 

9 Replies

  • Hi Dave,

    if you are already termining the SSL then it should be as simple as the following

     
    when HTTP_REQUEST {
       if { ([HTTP::host] eq "www.whatever.com") and ([HTTP::uri] eq "") } {
           HTTP::redirect "https://www.suntin-else.com"
          }
    }
    
    

    I hope this helps

    Bhattman
  • I am not offloading SSL to the Virtual server. I have a clientssl profile that is used for decrypting traffic for redirecting to a maintenance page ihat is running on PORT 80 in the event that no pool members are available (the pool members are configured for 443 in the pool). Thus, not offloading SSL.

     

     

    BUt thanks for your reply, sorry that I didnt make that evident.

     

     

    Any more ideas!?!? As always appreciate the help. I have never had a question or issue go unaswered.

     

     

    Thanks

     

     

     

    Dave
  • Hi Dave,

     

     

    If you want to inspect or interact with the HTTP for an HTTPS VIP, you'll need to add a client SSL profile and leave the SSL filter enabled. Bhattman's rule should work fine for this. Though the URI should never be a null string. HTTP user-Agents must set the URI to at least / even if the user doesn't do this.

     

     

    Aaron
  • Ok I get what you guys are laying down now. I created the iRule and its the only iRULE on my HTTPS VIP, but now all traffic just hangs. The browser just churns and churns when I apply this iRULE. The code is below. Even if you put the exact URL for the new domain I want to preference. However, as soon as I go onto the VIP and remove this iRULE the browser immediately pops up the site.

     

     

    What am I doing wrong?

     

     

    Thanks guys. Dave

     

     

     

     

    when HTTP_REQUEST { 
    if { [HTTP::host] == "olddomainname" } { 
    HTTP::redirect "https://newdomainname[HTTP::uri]" } 
    }

     

     

     

  • If the VIP has a client SSL profile enabled and the pool members are expecting HTTPS, you'd either want to change the servers to listen on port 80 for HTTP and change the pool configuration or add a server SSL profile to the VIP to have LTM re-encrypt the serverside traffic.

     

     

    Aaron
  • Boom!

     

     

    Adding the Server SSL profile did it! I always wanted to offload SSL for the site in question, but the developers didnt want to for fear that someone could set their local host file to IP of server and access site on HTTP if they were on our internal network. Stupid since we run Cisco NAC here and any outsiders would be isolated to restricted VLAN. Anyway ...

     

     

    Thanks Hoolio! this did it for me!

     

     

    Dave
  • guys,

     

     

    I created a VS redirecioanamento only make the traffic from a domain to another fqdn. In both'm using https and both domains have different ip's.

     

     

    for example

     

    https://site1.com redirect to https://mysite.com

     

     

    How can I make the iRule?

     

     

    Can you help me?

     

     

    Luis

     

  • guys,

     

     

    I created a VS redirecioanamento only make the traffic from a domain to another fqdn. In both'm using https and both domains have different ip's.

     

     

    for example

     

    https://site1.com redirect to https://mysite.com

     

     

    How can I make the iRule?

     

     

    Can you help me?

     

     

    Luis Carlos
  • You can detect the target domain with [HTTP::host] and the perform a redirect.

    This is a 302 - Temporary Redirect. If you want a 301 - Permanent then you will need to change it to HTTP::respond 301 Locaton "https://www.website.com"

    
    when HTTP_REQUEST {
    if { [HTTP::host] eq "site1.com" } {
    HTTP::redirect "https://mysite.com"
    }
    }