Forum Discussion

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

Redirect the web browser

Looking for a irule that will redirect the web browser from HTTP://Name_they_are_forcing.domain.com to HTTP://Name_we_select.domain.com. We have the certificate for Name_we_select.domain.com and don't want to add the Name_they_are_forcing.domain.com to the cert.

 

 

 

3 Replies

  • Hi Mike,

    Something like this?

    
    when HTTP_REQUEST {
    
       if {[string tolower [HTTP::host]] eq "name_they_are_forcing.domain.com"}{
          HTTP::redirect "http://name_we_select.domain.com"
       }
    }
    

    Certs won't come into play if you're not using HTTPS. If you don't have a cert for the other domain, you wouldn't be able to decrypt HTTPS requests to redirect them.

    Aaron
  • I knew this was going to be an easy irule. A few things I did forget - yes it is HTTPS, and second there is a extension to both URLS as in "https://name_they_are_forcing.domain.com/owa" and "https://name_we_selected.domain.com/owa"

     

     

    Also if we wanted to add a section in if they forget to add the"/owa" it will insert it. THe below code is in a different rule. Can it be added to this rule also

     

    if {([HTTP::uri] == "/") } {

     

    HTTP::uri /owa

     

    }

     

    or would you add

     

    if {[string tolower {HTTP::host]} eq

     

    "HTTPS://name_they_forcing.domain.com/owa" or "HTTPS://name_they_are_forcing.domain.com"}{

     

    Http::redirect "https://name_we_select.domain.com/owa"

     

     

  • Something like this should work:

    when HTTP_REQUEST {
    
       if {[string tolower [HTTP::host]] eq "name_they_are_forcing.domain.com"}{
          HTTP::redirect "http://name_we_select.domain.com"
       } elseif {[HTTP::uri] eq "/"}{
          HTTP::uri "/owa"
       }
    }
    

    Aaron