Forum Discussion

Parveez_70209's avatar
Parveez_70209
Icon for Nimbostratus rankNimbostratus
Oct 25, 2014

'OR' logic between Daga-Groups present in Irule

Hi Team,

Query related to the below Irule:

  1. dg_glob_blocks_starts_with and dg_lenovo_mgd_url_blocks are data groups, we wanted to have 'OR' logic between them, will || work ? 2.If point 1. is correct, still I am getting Irule error, kindly guide ?

when HTTP_REQUEST priority 500 { if {[class match [HTTP::uri] contains dg_glob_block_contains]}{ HTTP::redirect "http://www.XYZ.com" } elseif {[class match [HTTP::uri] starts_with dg_glob_blocks_starts_with] || [class match [HTTP::uri] starts_with dg_lenovo_mgd_url_blocks] } HTTP::respond 302 Location "http://www.XYZ.com"

log local0. " redirected to http://www.XYZ.com"
             return

}

Thanks and Regards PZ

3 Replies

  • kunjan's avatar
    kunjan
    Icon for Nimbostratus rankNimbostratus

    Parenthesis missing after elseif

    when HTTP_REQUEST priority 500 {
        if {
            [class match [HTTP::uri] contains dg_glob_block_contains]
        } {
            HTTP::redirect "http://www.XYZ.com"
        }
        elseif {
            [class match [HTTP::uri] starts_with dg_glob_blocks_starts_with ] or
            [class match [HTTP::uri] starts_with dg_lenovo_mgd_url_blocks]
        } {
            HTTP::respond 302 Location "http://www.XYZ.com"
            log local0. " redirected to http://www.XYZ.com"
            return
        }
     }
    
  • Ok kunjan thank you..so u mean || will be supported by or statement..and if all good thnn will our logic works here..will wait for the feedback..this needs to be rollout into one of our proje t.

     

  • Hi All,

    Still showing error, kindly guide:

    when HTTP_REQUEST priority 500 { if {[class match [HTTP::uri] contains dg_glob_block_contains]}{ HTTP::redirect "http://www.lenovo.com" } elseif {[class match [HTTP::uri] starts_with dg_glob_blocks_starts_with] || [class match [HTTP::uri] starts_with dg_lenovo_mgd_url_blocks]} HTTP::respond 302 Location "http://www.lenovo.com"

    log local0. " redirected to http://www.lenovo.com"
                 return
    

    }

    Thanks and Regards Parveez