Forum Discussion

TMcGov_92811's avatar
TMcGov_92811
Icon for Nimbostratus rankNimbostratus
Jan 27, 2009

Problems with TCL nesting

I've been struggling with the proper TCL nesting for this iRule. Individual clauses are working correct when apart, but bringing them all into the same iRule has been challenging. Any help would be appreciated.

 

 

Here's my Logic:

 

- Check the Client IP against my datagroup to see if it matches, and if it does, AND if it has "/cf/" or "/hf/" in its URI, use PoolA.

 

- If the Client IP matches but it doesn't have "/cf/" or "/hf/" in its URI, use PoolB.

 

- If the Client IP does NOT match my datagroup, and if it has "/cf/" or "/hf/" in its URI, use PoolC.

 

- If the Client IP does NOT match my datagroup, and if it has "/vh/" in its URI, use PoolD

 

- If the Client IP does NOT match my datagroup, and has none of the previous URIs, use pool Default.

 

 

Here's my iRule

 

 

when HTTP_REQUEST {

 

if {[matchclass $::test equals [IP::client_addr]]} { {

 

if {[HTTP::uri] contains "/cf/" or [HTTP::uri] contains "/hf/"} {

 

pool PoolA }

 

else {

 

pool PoolB } } } }

 

elseif {[HTTP::uri] contains "/cf/" or [HTTP::uri] contains "/hf/"}{

 

pool PoolC }

 

elseif {[HTTP::uri] contains "/vh/"} {

 

pool PoolD }

 

else {

 

pool Default

 

}

 

}

 

 

Here's the iRule Editor error message:

 

line2: [undefined procedure:

 

line10: [undefined procedure: elseif][elseif {[HTTP::uri] contains "/vh/"}{

 

 

1 Reply