Forum Discussion

mj_almassud_136's avatar
mj_almassud_136
Icon for Nimbostratus rankNimbostratus
May 12, 2014

http to https VIP

hi all,

 

so we have an application that requires connecting to a specific URL, but this application only supports "http". we happen to have an "https" URL that this application needs to connect to, so I though of creating a VIP that listens on port 80, and then plugged the URL as a pool member on port 443.

 

this seems to get the initial connection to work, but then the URL sends a redirection to the client, and Yes it is "https" so when the client attempts to connect to the VIP on 443, of course it fails.

 

so I was wondering if there's a way to resolve this problem using an iRule.

 

anyone can help with this :)

 

Thanks

 

44 Replies

  • Arie's avatar
    Arie
    Icon for Altostratus rankAltostratus

    Cory's iRule includes a check to see if the host value contains a string. However, the screen capture of the TCP stream shows no value for the host. Did you remove it from the image or is it indeed blank?

     

  • I removed it to avoid violating company policies.

     

    sorry, I should have mentioned that or replaced it with a text that says "Removed"

     

  • Arie's avatar
    Arie
    Icon for Altostratus rankAltostratus

    OK - makes sense. However, there doesn't seem to be a header "Content-Type" in the server response. The iRule requires it, though. Have you tried removing that check from the iRule?

     

  • Arie's avatar
    Arie
    Icon for Altostratus rankAltostratus

    Thanks - that is helpful.

     

    However, it does appear that there is no HTTP Response Header "Content-Type" in the server response. This would keep the code in the if-statement from being triggered.

     

  • So let's modify the if statement to this and see if that makes a difference:

    when HTTP_REQUEST {
    
        Save the requested host value
       set host [string tolower [HTTP::host]]
    
    
        Disable the stream filter by default
       STREAM::disable
    }
    when HTTP_RESPONSE {
    
        Check if response type is text and host isn't null
       if {$host ne ""}{
    
           Replace https://$host with http://$host
          STREAM::expression "@https://$host@http://$host@"
    
           Enable the stream filter for this response only
          STREAM::enable
    
    }
    }
    
  • This seems promising and I think it'll work. I did some testing on it, but I can't do a full test right now, because I am out the rest of the week and I don't have access to all the information that I need to complete this test.

     

    as of now, I am getting the login failed back from the server, which means that I am making all the way to the server and getting the response back as expected and it's all showing http on the browser address bar.

     

  • Hi MJ

     

    I have the same requirement and followed suggestions made by Cory but it seems for me it did not work. Can you help me more on this?

     

    Still my server redirecting to HTTPs not http.

     

    -Vishu