Forum Discussion

jonathanw84's avatar
Nov 10, 2020

Need Help with Case Insensitive iRule for Apache Migration

Hi All,

 

I have been helping on migrating our Apache environments into our F5 and everything has been working well, until we noticed that case insensitivity is not working. Here is the issue I am running into:

 

If I go to www.website.com/test it works just fine. If I go to www.website.com/TEST, it does not work at all.

 

I have the rewrite profile in place and the following iRule as well:

 

when HTTP_REQUEST {

  set uri [string tolower [HTTP::uri]]

  if { not ( [HTTP::path] ends_with "/") && not (

  [URI::basename [HTTP::uri]] contains "." ) } {

    # Append slash and keep querystring when it exists

    HTTP::uri [HTTP::path]/[expr { "[URI::query [HTTP::uri]]"

    eq {} ? {} : "?[URI::query [HTTP::uri]]" }]

  }

  if { [string tolower [HTTP::uri]] starts_with "/apps" } {

    pool ProxyPass_DEV_pool_2

  }

  else {

    pool ProxyPass_DEV_pool_1

  }

}

 

I figured line 2 "set uri [string tolower [HTTP::uri]]" would have fixed this but no dice. Any help would be greatly appreciated.

 

Thanks!

1 Reply

  • Line 2 is just setting it as a variable. Either you have to use the set variable in your code,

    HTTP::uri $uri

    or you have to use something like below,

    HTTP::uri [string tolower [HTTP::uri]]