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

HumanSky's avatar
HumanSky
Icon for Nimbostratus rankNimbostratus
Jan 18, 2024

F5 iRule Redirect Issue

Hello all,

I'm new to F5, so I apologize if I'm not doing this correctly. I have a current iRule that is set to redirect from domain A to domain B if certain criteria happen. For instance, if someone goes to domainA.com/1234, it should redirect to domainB.com/path?id=1234. If there is no "1234" in the URL, it should go to the landing page of Domain B

Here's my current redirect rule for domain A:

 

 

if { [HTTP::uri] equals "/" } then {
  HTTP::redirect "https://domainb/path"
} else {
  HTTP::redirect "https://domainB/path?id=[URI::encode [string range [HTTP::uri] 1 end]]"
}   

 

 

This works well, except if someone uses a service like MailChimp. Those services append tracking information, so domainA.com/1234 becomes domainA.com/1234?utm_campaign=foo. This will break the URL for DomainB, since the campaign tracking information will become URL escaped characters. What would be the best way to fix this issue?

2 Replies

  • Hi HumanSky,

    If you don't want to consider the query parameters at all, you can use HTTP::path instead of HTTP::uri. If you need to strip just a specific query parameter and its value, you can do an if exists condition for that with the URI::query command and then act accordingly.