Forum Discussion

gh0std0g_79292's avatar
gh0std0g_79292
Icon for Nimbostratus rankNimbostratus
Apr 12, 2012

http -> https redirection and hostname replace not working

so i have a very basic iRule for https redirects and hostname replacement and append uri...

 

 

 

when HTTP_REQUEST {

 

if { [http::host] equals "aaa.xyz.com"} {

 

http::redirect "https://ccc.xyz.com/oa_html/ibuhpage.jsp"}

 

if { [http::host] equals "bbb.xyz.com"} {

 

http::redirect "https://ccc.xyz.com/oa_html/appslocallogin.jsp"}

 

}

 

 

 

My problem is that the aaa.xyz.com does not redirect to https... it remains http... the only difference between aaa and bbb is that the aaa site has both secure and insecure content...

 

 

any ideas?

 

  • how's this go for you?

     

     

    when HTTP_REQUEST {

     

    set H [HTTP::host]

     

     

    if { [string match "aaa.xyz.com" $H] } {

     

    HTTP::redirect https://ccc.xyz.com/oa_html/ibuhpage.jsp

     

    return

     

    }

     

     

    if { [string match "bbb.xyz.com" $H] } {

     

    HTTP::redirect https://ccc.xyz.com/oa_html/appslocallogin.jsp

     

    return

     

    }

     

     

    }

     

     

    The code just sends a 302 HTTP redirect, shouldnt drop https://->http:// unless there is a server that isnt responding on https:// in the first place (because the 302 fails from the client browser).

     

     

    ...or the server itself sends its own 302 to point back at http://, but I cannot see why anyone would do that who intended to host SSL in the first place

     

  • can you try this?

    when HTTP_REQUEST {  
       if { [HTTP::host] equals "aaa.xyz.com" and [HTTP::uri] equals "/"} {  
          HTTP::redirect "https://ccc.xyz.com/oa_html/ibuhpage.jsp"
       } elseif { [HTTP::host] equals "bbb.xyz.com" and [HTTP::uri] equals "/" } {  
          HTTP::redirect "https://ccc.xyz.com/oa_html/appslocallogin.jsp"
       } 
    }