Technical Forum
Ask questions. Discover Answers.
cancel
Showing results for 
Search instead for 
Did you mean: 
Custom Alert Banner

how to Redirect http to https exception any host

Dzungchu
Nimbostratus
Nimbostratus

hi all,

I has created a irule to redirect http to https exception any IP (example: 10.1.2.0/29) however it is not OK.

could someone share what code to use?

now i only can redirect all request from http--> https with code below.

 

when HTTP_REQUEST {

 if { [HTTP::host] equals "abc.com.vn" } {

     HTTP::redirect https://abc.com.vn[HTTP::uri]

    }

}

1 REPLY 1

You can use below iRule. Under Allow-List datagroup, you can add host/network which you want to exempt from the redirection.

when HTTP_REQUEST {
if { [HTTP::host] equals "abc.com.vn" } {
if {not ([class match [IP::client_addr] equals Allow-List])} {
HTTP::redirect https://abc.com.vn[HTTP::uri]
}
}
}

Hope it works for you,

Mayur