Forum Discussion

babaransari_361's avatar
babaransari_361
Icon for Nimbostratus rankNimbostratus
Jun 01, 2018

https redirection using single virtual server

need to configure an irule to perform https redirection using a single virtual server. The url http://abc.com:8080 needs to be redirected to https://abc.com:8080 but i need to achieve this redirection using only one virtual server which is listening on https. I have the below irule configured but after redirection the page does not proceed further while authenticating with the login credentials.

 

when HTTP_REQUEST { if { [URI::protocol [HTTP::uri]] eq "https" } { event disable all } else { HTTP::redirect https://[getfield [HTTP::host] ":" 1]:8080[HTTP::uri]; event disable all } }

 

2 Replies

  • Hi,

    You trigge your irule to "HTTP_REQUEST" it's too late try this:

    when RULE_INIT {
    
    set redirect 0
    
    if { [URI::protocol [HTTP::uri]] eq "https" } {
        set redirect 0
        event disable all 
    } else {
    
    set redirect 1
    
    }
    
    }
    
    
    
    when HTTP_REQUEST { 
    
    if { $redirect } {
    
        HTTP::redirect https://[getfield [HTTP::host] ":" 1]:8080[HTTP::uri]
        event disable all 
    }
    
    }
    

    Keep me in touch

    regards