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

Zev's avatar
Zev
Icon for Altostratus rankAltostratus
May 09, 2018

Redirect/URI change based on numeric variable

I've had what I think is an interesting customer request. Although this may be a simple redirect it seems more complex and haven't been able to put all the pieces together. The customer has a URL:

 

https://x.123.com/123.asp?r=&p=https%3A//site.com/&llactid=34567&llnocookies=undefined

 

There is a distinct ID in URIs, 34567 in this case, and we wish all IDs greater than 29999 but not equal to 30484 to be altered and redirected to:

 

https://y.abc.com/trackalyze.asp?r=&p=https%3A//site.com/&llactid=34567&llnocookies=undefined

 

in order to route/balance this traffic as it hits BigIP. All IDs below that threshold would remain unchanged. Is a policy best for this or can this be done syntactically in an iRule? I've been trying simple if-then [HTTP::uri] logic but not sure how to account for the numeric variable and hitting deadends. I guess anything can be done. Many thanks!

 

x <= 29999 including 30484 go to site A/uri

 

x > 29999 /= 30484 go to site B/uri

 

1 Reply

  • This should work:

    when HTTP_REQUEST {
        if { ([HTTP::host] eq "x.123.com") && [HTTP::uri] starts_with "/123.asp" } {
            set llactid [URI::query [HTTP::uri] "llactid"]
            if { ($llactid ne 30484) && $llactid > 29999 } {
                HTTP::redirect "https://y.abc.com/trackalyze.asp?r=&p=https%3A//site.com/&llactid=$llactid&llnocookies=undefined"
            }
        }
    }