Redirects or appends

I was wondering I have about 20 or so redirects for urls because my development team will not put them on the servers. If a uri does not have a / at the end of it would it be possible to append this with an Irule? I tried look at this and I am using the http redirect for this and sending a redirect with the / after the uri.ex

user request the following

https://mydomain.com/app1

I use the redirect to

https://mydomain/app1/

Of course this sets up 10 -15 per site

I would like to say any url that doesn’t end with / append / how ever this would cause problems for legit uri’d not needing the / at the end like ig the application sends back

https://mydomain.com/app1/loging.asp

etc…

It sounds like you’re unsure of what methodology to use for determining when to change the URI. If it’s a relatively small, known list of URIs you want to redirect, you could define them in a class and then rewrite the URI or redirect based on the class definition.

Or if it’s not a known list, you could look for any URI that has a period and then some set number of characters and append a trailing slash (ie, append a slash if there is a . followed by less than 4 characters that doesn’t end with a forward slash).

To use the first method, define a class (aka datagroup in the GUI) with the URIs you want to redirect for:

class uris_to_redirect {
   "/app1"
   "/app2"
   "/another_uri_to_change"
}

Then use a rule like this to redirect clients requesting one of these URIs:

when HTTP_REQUEST {
   if { [matchclass [string tolower [HTTP::uri]] equals $::uris_to_redirect] }{
      HTTP::redirect "http://[HTTP::host][HTTP::uri]/"
   }
}

Note that I didn’t test this for syntax, but I think it’s one valid example of how to handle the scenario you are describing.

Aaron