Forum Discussion
Search and Replace URL using iRule
I am very new to iRule and this could be very basic, so please bear with me.
We are having a change in the url context and hence all new urls will include a new context after the domain. I need a iRule which can make it backward compatible and replace/rewrite any urls hitting the F5 with the old context using new context.
Old URL: https://help.test.com/lmprd/ClickService?token=dsadasasdass
New URL: https://help.test.com/newprd/ClickService?token=dsadasasdass
The iRule need to look for anything hitting the F5, containing "lmprd" to be replaced with "newprd" and redirect after that. Everything else in the URL remains the same.
Any help will be highly appreciated.
1 Reply
HI.
Is this helpful?
when HTTP_REQUEST { if { [HTTP::uri] starts_with "/lmprd/" } { HTTP::uri [string map {"/lmprd/" "/newprd/"} [HTTP::uri]] } log local0. "[HTTP::uri]" } /var/log/ltm Jul 12 11:41:40 g5v-13112 info tmm[10349]: Rule /Common/My_rule2 <HTTP_REQUEST>: /newprd/ClickService?token=dsadasasdass
Recent Discussions
Related Content
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com