F5 Load Balancer iRule, how to remove double slash from URL

I used the following iRule to remove a double slash that was showing up in one of the web applications here at work. the double slash only appeared after the word “file” so we were able to explicitly deal with this by asking if the HTTP:uri (which is everything after the base domain name) started with the broken URL.

when HTTP_REQUEST {
  if { [string tolower [HTTP::uri]] starts_with "/usq/file//" } {
    HTTP::uri [string map -nocase {"/usq/file//" "/usq/file/"} [HTTP::uri]]
  }
}
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s