That looks like a good start. Which LTM version are you testing this for? If you’re on 10.x you should replace matchclass with the class command and remove the $:: prefix from the datagroup name references in the iRule. You could then use class match -value to get the old service to new service mapping from the datagroup. The datagroup would be a string type with the key being the old app paths and the values being the new app path.
For 9.x, you can use findclass with the datagroup set as a string with the old_app and new_app paths separated by a space.
We are using the 9x version. Can you give an example for the 9x with the findclass? What if we don’t use the data class and just want to use the “string tolower” to achieve the matching exact URI and redirect to the new app?
It was redirecting to a service not active on our web server. That is resolved now that the virtual directory is started.
Is there an easier way in doing this? maybe call and match old URI to new URI in a data class group? If we get up to a hundred /app directories, the code can get quite messy and long. Please advise on this since I am sure you have seen this before.
I have followed the wiki and based on the example, how do I call the class in the irule? I tried to create a data group but could not figure out how to do so.
How would you use the “class” statement with LTM version 9.x? Do I use the class statement in the actual irule or call it using a matchclass?
You are actually calling up the class object in your iRule. I do want to clarify that “class URIRedirects” is not something you put into an iRule. You have to create a data group called URIredirects with type string and then enter “/old-service/old-app1/ https://www.mysite.com/new-service/new-app100”.