Forum Discussion

Malcolm_Salmons's avatar
Malcolm_Salmons
Icon for Nimbostratus rankNimbostratus
Sep 07, 2005

Addition of trailing slash to url

Hi

 

 

I have a pair of big-ip set up with a virtual server configured. The big-ip's terminate ssl traffic and forward the request as http. Everything work fine when I go to the basic url say:

 

 

www.test.com

 

 

However when I try to go to any directories, e.g.

 

 

www.test.com/test

 

 

I get the error - page cannot be displayed. However, when I added a trainling slash, i.e.

 

 

www.test.com/test/

 

 

Everything works fine. Does anybody know if I can add a trailing slash using irules and if so what I would need to specify in the rule.

 

 

Thanks in advance

 

 

Malcolm

1 Reply

  • You can use the ends_with operator. If it does not end with a slash, then you can use the builtin "append" operator and then reset the URI with the HTTP::uri command.

    when HTTP_REQUEST { 
      set uri [HTTP::uri]
      if { ! ( $uri ends_with "/" ) } {
        append uri "/"
        HTTP::uri $uri
      }
    }

    You might want to be careful that you don't append slashes to file requests though (ie. http://server/foo.gif).

    Generally the webserver has a builtin way to redirect directory based requests that might be more foolproof.

    -Joe