In this week’s Post of Week, I address community member Shann_P’s question on how to make an iRule update a string at a specific location within the path of the URI:

The iRule needs to be able to locate the 7th "chunk" of the URI, add a period (.) to the end of it and re-insert it back into the URI before passing it back to the pool.

He mentioned regex as a possibility and I shuddered with a cold chill running up my spine! Regex, while totally capable, should be the absolute last resort in an iRule due to performance reasons. Tcl’s string commands are my go to tools in the iRules toolbox for situations like this, and this was a job for string map. The solution to Shann_P's question is covered in the video below, and also answered in the original question.

But wait! This week you get a special BONUS Post of the Week, where I detail an unrelated example on multiple mapping patterns with the string map command.

Resources