Forum Discussion

Anthony_891's avatar
Anthony_891
Icon for Nimbostratus rankNimbostratus
Sep 19, 2012

HTTP to HTTPS in the response exception

I have an iRule that needs to execute to fix a problem. As usual it has caused another issue with one of our clients. I need it to execute everytime except with the URL is www.waterworldcalifornia.com. See iRule below

 

iRule in development

 

when HTTP_REQUEST {

 

save hostname for use in response

 

set fqdn_name [HTTP::host]

 

}

 

when HTTP_RESPONSE {

 

if {[HTTP::is_redirect] }{

 

if {[$fqdn_name contains "waterworldcalifornia.com"]}{

 

Exit this event from this iRule

 

return

 

} else {

 

 

if { [HTTP::header Location] starts_with "/" }{

 

HTTP::header replace Location " Location]"

 

} else {

 

HTTP::header replace Location [string map -nocase "http:// https://" [HTTP::header Location]]

 

}

 

}

 

}

 

}

 

iRule in production that breaks the redirection to http://www.waterworldcalifornia.com Waterworldcalifornia does not have a HTTPS site.

 

when HTTP_REQUEST {

 

save hostname for use in response

 

set fqdn_name [HTTP::host]

 

}

 

when HTTP_RESPONSE {

 

if { [HTTP::is_redirect] }{

 

if { [HTTP::header Location] starts_with "/" }{

 

HTTP::header replace Location " Location]"

 

} else {

 

HTTP::header replace Location [string map -nocase "http:// https://" [HTTP::header Location]]

 

}

 

}

 

}

 

 

I have tried this many different ways to no resolution. So I will ask the community for help.

 

  • Try this:

     

     

    if { ( [HTTP::is_redirect] ) and not ( [string tolower $fqdn_name] contains "waterworldcalifornia.com" ) }{