Forum Discussion

Dineshsankar_31's avatar
Dineshsankar_31
Icon for Altostratus rankAltostratus
Aug 09, 2017

https to https FQDN redirection

What is the irule for redirecting to https://abc.global.com, i tried below i rule but it doesn't help my requirement.

 

1. when HTTP_REQUEST { if { [HTTP::host] contains "abc" } { HTTP::redirect "https://abc.global.com[HTTP::uri]" } }

 

2. when HTTP_REQUEST { if { [string tolower [HTTP::host]] ends_with "abc" } { HTTP::redirect "http://abc.global.com:82[HTTP::uri]" } }

 

3. when HTTP_REQUEST { { HTTP::redirect " http://abc.global.com:82[HTTP::uri]" } }

 

4. when HTTP_REQUEST { if { [string tolower [HTTP::uri]] equals "abc" } { HTTP::redirect "; } }

 

7 Replies

  • Hi,

    Based on your sentence, I would say that you should put in place the below irule

    when HTTP_REQUEST {
        if { [HTTP::host] eq "abc" } {
            HTTP::redirect "https://abc.global.com[HTTP::uri]"
        }
    }
    
    • Dineshsankar_31's avatar
      Dineshsankar_31
      Icon for Altostratus rankAltostratus

      i tried this also But the VIP having certificate. So when i do it will throw SSL error then after it will redirect to Fqdn. I want before ssl error it should redirect.

       

    • Yann_Desmarest's avatar
      Yann_Desmarest
      Icon for Cirrus rankCirrus

      Hi,

       

      That's not possible like this.

       

      You need to have a valid certificate for abc too.

       

      If you have more than one host name or domain on the same VS, you should use SNI feature at SSL level or a certificate with those names in the SAN field

       

  • Hi,

    Based on your sentence, I would say that you should put in place the below irule

    when HTTP_REQUEST {
        if { [HTTP::host] eq "abc" } {
            HTTP::redirect "https://abc.global.com[HTTP::uri]"
        }
    }
    
    • Dineshsankar_31's avatar
      Dineshsankar_31
      Icon for Altostratus rankAltostratus

      i tried this also But the VIP having certificate. So when i do it will throw SSL error then after it will redirect to Fqdn. I want before ssl error it should redirect.

       

    • Yann_Desmarest_'s avatar
      Yann_Desmarest_
      Icon for Nacreous rankNacreous

      Hi,

       

      That's not possible like this.

       

      You need to have a valid certificate for abc too.

       

      If you have more than one host name or domain on the same VS, you should use SNI feature at SSL level or a certificate with those names in the SAN field

       

  • Can you give this a try, you may also should look at DNS suffixes option. That would be lot easier.

    when HTTP_REQUEST {
    set URI [string tolower [HTTP::uri]]
    {
    HTTP::respond 301 Location "https://abc.global.com$URI"
    return
    }
    }