Forum Discussion

Jeff_Richards_4's avatar
Jeff_Richards_4
Icon for Nimbostratus rankNimbostratus
Mar 15, 2005

iRules matchclass

I'm having trouble getting an iRule to work with matchclass. This is the rule I'm trying to use:

 
 when HTTP_REQUEST {      
     if { [matchclass [HTTP::host] equals $::CorpWebHostNames] } {    
        use pool CorpWeb  
     }    
     else {       
        use pool ProdWeb    
     }  
 } 
 

And I keep getting this error:

01070151:3: Rule [test] error:

line 5: [undefined procedure: else] [else

{

use pool ProdWeb

}]

I've verified that the CorpWeb and ProdWeb pools exist. Can anyone see what's wrong with my rule? Thanks.

2 Replies

  • unRuleY_95363's avatar
    unRuleY_95363
    Historic F5 Account
    Yeah, this is due to a known problem with whitespace following the '}' close brace on the line preceding the 'else'. We have a CR for this and will get it fixed in the next release. Getting this extra whitespace is a really easy thing to do if you are at all cutting and pasting.

    In the meantime, either be extra sure there is no trailing whitespace at the end of your lines or simply put the 'else {' on the same line as in:

     
     when HTTP_REQUEST { 
        if { [matchclass [HTTP::host] equals $::CorpWebHostNames] } { 
           use pool CorpWeb 
        } else { 
           use pool ProdWeb 
        } 
     }