Forum Discussion

hasnain_a's avatar
hasnain_a
Icon for Nimbostratus rankNimbostratus
Sep 06, 2018

Help with irule for setting serverssl to enable

Hi, I need help with an irule. Currently this irule sets the serverssl to enabled on a Virtual server if the URL starts with a particular set of characters, which works fine. In the code below I am calling it "abc". What I need to do now is add another URL, "def" to that so I tried by putting "or" and then the other URL but it doesn't seem to work. Please see the current code below.

 

    when HTTP_REQUEST {

set my_pool [class match -value [string tolower [HTTP::host]] starts_with URL_pools]

log local0. "[HTTP::host] --> $my_pool "

   if {$my_pool ne ""} {
       pool $my_pool   
     }
unset my_pool

set useServerSSL 0
if { [HTTP::host] starts_with "abc" } {
   set useServerSSL 1
}


}

when SERVER_CONNECTED { if { $useServerSSL == 0 } { SSL::disable serverside } }

 

I tried putting in the second URL (def) after the "abc" as shown below but then both url's don't work.

 

if { [HTTP::host] starts_with "abc" or [HTTP::host] starts_with "def" } {
   set useServerSSL 1
}

I would appreciate any help. Thank you.

 

  • Try this:

    if { ( [HTTP::host] starts_with "abc" ) or ( [HTTP::host] starts_with "def" ) } {
        set useServerSSL 1
    }