Forum Discussion

Mike_Conant_598's avatar
Mike_Conant_598
Icon for Nimbostratus rankNimbostratus
Mar 07, 2005

Rules Problem

We just upgraded from 4.2 LB to 4.5.10 HA software on our Dell platform 2650 poweredge. We purchased this upgrade so that we could utilize rules based filtering of traffic based on a certain URI. We had an F5 partner perform the upgrade and write the rule. The rule does NOT work infact when we enable the rule on our box our site is unreachable. The F5 partner could not understand why this was happening. I placed a support call to F5 and open a case. The response from F5 was we dont help you with rules and that I would need to post my problem to DevCentral in hopes of someone here being able to help us. This is not at all what I expect for for support when I just paid close to 3K for one year of F5 support. Our rule is below has anyone had this problem before? I can be reached at mike@touchcominc.com we tried what F5 suggested below with no success.

 

 

You currently have this as a rule:

 

 

if (http_uri matches_regex "/onefacility/reporttest") {

 

use pool reporttesthttp

 

}

 

else {

 

use pool onefacilityhttp

 

}

 

 

Give this a try:

 

 

if (http_uri matches_regex "/onefacility/reporttest/") {

 

use pool reporttesthttp

 

}

 

else {

 

use pool onefacilityhttp

 

}

 

 

Respectfully,

 

 

Steve

 

 

--

 

/*

 

* Steve Pecsi | Network Support Engineer | www.f5.com

 

* P. 206 272 6888 | P. 1-888-88-BIGIP(24447)

 

* F5 Networks | 401 Elliott Avenue West | Seattle, Washington 98119

 

*

 

*

 

* The Leader in Application Traffic Management

 

* Ensuring secure and optimized application delivery for global enterprises

 

*

 

 

 

  • bknotwell_12713's avatar
    bknotwell_12713
    Historic F5 Account
    I'm not exactly sure why your rule isn't working (though I think you probably want to use the contains operator instead of matches_regex).

    I've appended some (sanitized) working 4.x rules that heavily use matches_regex:

     
      load balancing rules 
     rule a { 
        if (http_uri contains "/apack/") { 
           use pool a 
        } 
        else { 
           if (http_uri contains ".cgi") { 
              use pool acgi 
           } 
           else { 
              use pool ahtml      } 
        } 
     } 
     rule b{ 
        if (http_uri contains "/bpack/") { 
           use pool b 
        } 
        else { 
           if (http_uri contains ".cgi") { 
              use pool bcgi 
           } 
           else { 
              use pool bhtml 
           } 
        } 
     } 
     rule c { 
        if (http_uri matches_regex "\/~()(\/|$)") { 
           use pool ccgi 
        } 
        else { 
           use pool cnormalcgi 
        } 
     } 
     rule d { 
        if (http_uri matches_regex "\/~()(\/|$)") { 
           use pool dhtml 
        } 
        else { 
           use pool dcache 
        } 
     } 
     rule e { 
        if (http_uri matches_regex "\/~(frobnosticate)(\/|$)") { 
           use pool ecgi 
        } 
        else { 
           use pool enormalcgi 
        } 
     } 
     rule f { 
        if (http_uri matches_regex "\/fpack\/") { 
           use pool f 
        } 
        else { 
           if (http_uri matches_regex "\.cgi") { 
              if (http_uri matches_regex "^\/~()(\/|$)") { 
                 use pool fcgi 
              } 
              else { 
                 use pool fnormal 
              } 
           } 
           else { 
              if (http_uri matches_regex "^\/~()(\/|$)") { 
                 use pool fhtml 
              } 
              else { 
                 use pool fhtmlx 
              } 
           } 
        } 
     } 
      
     rule g { 
        if (http_uri matches_regex "\/~(cola|lemonlime)(\/|$)") { 
           use pool g 
        } 
        else { 
           use pool gcgi 
        } 
     } 
      
     rule h { 
        if (http_uri matches_regex "^\/(~|%7E)(NON-STOP)(\/|$)") { 
           use pool hhtml 
        } 
        else { 
           use pool hcache 
        } 
     } 
     rule i { 
        if (http_uri matches_regex "^/(/|(\./))*ipack/" or http_uri matches_regex "^/(/|(\./))*(~|%7E|%7e).*/ipack(.|..)(bbs|mail|all)/") { 
           use pool i 
        } 
        else { 
           if (http_uri matches_regex "\.cgi($|\?|/|)") { 
              use pool icgi 
           } 
           else { 
              use pool ihtml 
           } 
        } 
     } 
      
     
  • I think your problem might be that in regex slash is a special char. You will need a backslash before each slash to treat it as a character.

     

     

    -Brian