Forum Discussion

techguru_90881's avatar
techguru_90881
Icon for Nimbostratus rankNimbostratus
Sep 04, 2013

IRULE for rewriting http request with https request

Currently we have configured https ://www.ABC.com on the LTM V11 , we are getting the homepage but if we select some of the TAB on the pages it redirect http pages . As per our requirement we need to rewrite all http response from the server with https and send back to client . For this we tried with a stream profile enable on the virtual server , with this we achieved our requirement but some of the images are not loading properly with stream profile enabled . Below are the stream profile irule we used :-

 

when HTTP_REQUEST { STREAM::disable HTTP::header remove "Accept-Encoding" } when HTTP_RESPONSE { if {[HTTP::header value Content-Type] contains "text"}{ STREAM::expression {@http://@https://@} STREAM::enable } }

 

But when we try with http://www.ABC.com all works fine . Also please suggest can we achieve the same with using some irules (without stream profile )

 

2 Replies

  • Just to make your code more readable :

     

    when HTTP_REQUEST { 
        STREAM::disable HTTP::header remove "Accept-Encoding" 
    }
    
    when HTTP_RESPONSE { 
        if {[HTTP::header value Content-Type] contains "text"}{ 
            STREAM::expression {@http://@https://@} STREAM::enable }     
    }

    Btw, have you tried this solutions?

     

    SOL7125: Configuring a virtual server to automatically redirect HTTP requests to HTTPS

     

    http://support.f5.com/kb/en-us/solutions/public/7000/100/sol7125.html

     

  • Can you determine via client side capture how the broken images are being referenced?