Forum Discussion

David_Oertli_18's avatar
David_Oertli_18
Icon for Nimbostratus rankNimbostratus
Apr 20, 2016
Solved

iRule Help selecting pool and SNAT_pool for specific URI's

We have an existing virutal server that we are trying to redirect traffic to different pools based on the URI requested. The iRule I have set up is below. The problem is that whenever a request for /a/* is sent the appropriate SNAT_pool and server pool are selected. However whenever a request for /TrafficDirector/* is sent the appropriate SNAT_pool is selected but the server pool the request is sent to is the default server pool. See below for the iRule:

when HTTP_REQUEST {
  switch -glob [ string tolower [HTTP::path]] {
    "/a/*" -
    "/TrafficDirector/*"
   {
       Select the corresponding pool and SNAT pool
      pool pandora.dev.foo.net_Inside_ProxyServers
      snatpool blockbrochure-dev.stackato-1.foo.com_SNATpool
      return
    }
    default {
       Select the default pool 
      pool dev.foo.com_pool
    }
  }
}

What am I missing here?

  • Couple questions/comments:

     

    1. Are you sure the correct SNAT pool is selecting? It looks like you're doing a tolower on the string, but then defining a mixed-case switch statement. Are any errors showing up in /var/log/ltm? 2. ProxyPass might be overkill for this, but it does cover all of your needs here... (do a DevCentral search for ProxyPass)

     

3 Replies

  • Couple questions/comments:

     

    1. Are you sure the correct SNAT pool is selecting? It looks like you're doing a tolower on the string, but then defining a mixed-case switch statement. Are any errors showing up in /var/log/ltm? 2. ProxyPass might be overkill for this, but it does cover all of your needs here... (do a DevCentral search for ProxyPass)

     

    • Chris_Grant's avatar
      Chris_Grant
      Icon for Employee rankEmployee
      AJ is correct. The tolower means that your match will be: /trafficdirector/* to /TrafficDirector/* Which will fail to match.
    • David_Oertli_18's avatar
      David_Oertli_18
      Icon for Nimbostratus rankNimbostratus
      Thanks AJ and Chris! I updated the string to be /trafficdirector/* and am now matching both requests for /trafficdirector/whatever and /TrafficDirector/whatever. Thanks for taking a look!!