Forum Discussion

adrianglendinning's avatar
adrianglendinning
Icon for Nimbostratus rankNimbostratus
May 21, 2024

redirect irule

Hi,

We are moving off A10s to F5s and we have an old a10 aflex rule which redirects certain traffic to a particular pool.

 

when HTTP_REQUEST {
if { [HTTP::uri] contains "<xyz>"} {
   pool test-pool.domain.com-443
} else { 
}
}

 

Could I get the syntax to get this working on the F5 please?

 

Thanks

Adrian

2 Replies

  • The syntax you have there should work without modification; A10's language is, how can I put it, eerily similar to iRules.

     

    I would strongly advise you (and anyone else using HTTP::uri) to use [HTTP::uri -normalized], though, to avoid an attacker being able to evade your iRule logic by encoding, escaping or inserting path traversal characters: https://clouddocs.f5.com/api/irules/HTTP__uri.html

  • Hope below example can help you:

    if you match "aol" traffic is sent to aol_pool otherwise is sent to the default pool associated to the VS.

    when HTTP_REQUEST {
      # case sensitive
      if { [HTTP::uri] contains "aol" } {
         pool aol_pool
      }

    }

     

    In below cases we can the default pool in the code.

    when HTTP_REQUEST {
      # case sensitive
      if { [HTTP::uri] contains "aol" } {
         pool aol_pool
      } else {
         pool all_pool
      }

      # case insensitive
      if { [string tolower [HTTP::uri]] contains "aol" } {
         pool aol_pool
      } else {
         pool all_pool
      }
    }

     

    References:

    https://clouddocs.f5.com/api/irules/contains.html

    https://clouddocs.f5.com/api/irules/HTTP__uri.html