For more information regarding the security incident at F5, the actions we are taking to address it, and our ongoing efforts to protect our customers, click here.

Forum Discussion

ChrisRodrigues's avatar
ChrisRodrigues
Icon for Nimbostratus rankNimbostratus
Aug 02, 2019

string map insert

I have the following uris that I would like to map a string and prepend a value to the string (in the examples below snt )

Any help with the iRules would be greatly appreciated

 

"/here.there/service/v1/customers/qualification" "/snt/here.there/service/v1/customers/qualification"

then use pool

 

"/here.there/service/v1/accounts/{accountNumber}" "/snt/here.there/service/v1/accounts/{accountNumber}"

then use pool

 

"/here.there/service/v1/accounts/{accountNumber}/paymentprofile" "/snt/here.there/service/v1/accounts/{accountNumber}/paymentprofile"

then use pool

5 Replies

  • JG's avatar
    JG
    Icon for Cumulonimbus rankCumulonimbus

    Is the "{accountNumber} variable? What's the format?

  • JG's avatar
    JG
    Icon for Cumulonimbus rankCumulonimbus

    Are these URLs literal, or do they include their sub-directories/paths?

  • JG's avatar
    JG
    Icon for Cumulonimbus rankCumulonimbus

    Try something like this one then:

    when HTTP_REQUEST {
        switch -- [string tolower [HTTP::uri]] {
            "/here.there/service/v1/customers/qualification" {
                HTTP::uri /snt[HTTP::uri]
                pool pool_1
            }
            "/here.there/service/v1/accounts/\{accountNumber\}/paymentprofile" {
                HTTP::uri /snt[HTTP::uri]
                pool pool_2
            }
            "/here.there/service/v1/accounts/\{accountNumber\}" {
                HTTP::uri /snt[HTTP::uri]
                pool pool_3
            }
            default {
                pool default_pool
            }
        }
    }

    .

  • Thanks JG for the quick responses. I tried this that worked. I could do this because I'm using the same pool for all my earlier examples.

    when HTTP_REQUEST {

    set uri [HTTP::uri [string map {"/here.there " "/snt/here.there "}[HTTP::uri]]]

          pool pool_name

     

    }

    realized I was just pre-pending snt (more like a find and replace)

     

    Thanks again!