Forum Discussion

mlick2's avatar
mlick2
Icon for Nimbostratus rankNimbostratus
Dec 05, 2014

Websphere data group irule

I am in the process of implementing Websphere. There is an irule requirement that lists uris. Rather than list them specifically in the irule, I want to call them in a data group. I haven't been able to figure out how to appropriately call the dg though.

 

Here is the irule which is working without a dg.

 

when HTTP_REQUEST { switch -glob [string tolower [HTTP::uri]] { "/a/" - "/b/" - "/c/*" { pool WEBSPHERE_POOL_9086 } default { HTTP::respond 200 content { Wrong URL } } } }

 

6 Replies

  • I just implemented something similar to the following:

    if {[class match [HTTP::uri] starts_with URL-DataGroup]} {
      pool WEBSPHERE_POOL_9086
    } else }
      HTTP::respond 200 content { Wrong URL }
    }
    
  • mlick2's avatar
    mlick2
    Icon for Nimbostratus rankNimbostratus

    I have tried the following; but get the TCL error when the rule is hit and am unable to access the site at all

    01220001:3: TCL error: /Common/WEBSPHERETEST2 - invalid command name "}" while executing "}"

    when HTTP_REQUEST {
    switch -glob [string tolower [HTTP::uri]] if{[class match [HTTP::uri] starts_with URL_DATAGROUP]
    {
    pool WEBSPHERE_POOL_9086
    }
    else {
    HTTP::respond 200 content {
    Wrong URL
         }
        }
     }
    }
    
  • Why are you trying to use a switch statement? The Datagroup is essentially an externalized switch. Did you try the syntax as I wrote originally? I'm not sure if it works for your case exactly.

     

  • mlick2's avatar
    mlick2
    Icon for Nimbostratus rankNimbostratus

    The switch statement was in the Websphere deployment guide. I had removed almost everything in the rule and it still wasn't working with what is below

    when HTTP_REQUEST {
    if{[class match [string tolower [HTTP::uri]] starts_with URL_DATAGROUP]
    {
    pool WEBSPHERE_POOL_9086
      }
     }
    }
    
    • shaggy's avatar
      shaggy
      Icon for Nimbostratus rankNimbostratus
      one issue i see - you're missing a } after DATAGROUP ], and there's an extra } at the end - should look like: when HTTP_REQUEST { if{[class match [string tolower [HTTP::uri]] starts_with URL_DATAGROUP]}{ pool WEBSPHERE_POOL_9086 } }