Forum Discussion
URL re-Write
Hi ,
I am trying to write an irule which would rewrite the uri as below:
original uri https://www.ABC.com/BBB/CCC/DDDD/TK?grant_type=client_credentials --> the part after TK "could be anything"
re-write to https://www.ABC.com/CCC/DDDD/TK?grant_type=client_credentials
I have tried many irules but nothing seems to work.
Your support is highly appreciated.
6 Replies
- nathe
Cirrocumulus
How about something like this?
when HTTP_REQUEST { set uri [HTTP::uri] if { $uri starts_with "/BBB" } { HTTP::uri [string range $uri 4 end] } }See info on String here string command
- anonymous_02_15
Nimbostratus
Hi Nathan ,
Thanks for your reply.
I forgot to to mention that I only need /BBB be removed when it is followed by /CCC , if it is followed by anything else I dont want the re-writing to happen.
- nathe
Cirrocumulus
Could we not check if it starts_with /BBB/CCC ?
- anonymous_02_15
Nimbostratus
Oh sorry , I misunderstood you.
Yes we can.. Thank you..
What does 4 mean in the irule?
- nathe
Cirrocumulus
String range is creating a new URI based on the existing one but starting 4 characters in I.e. ignoring /BBB
- Arie
Altostratus
Is the case (upper/lower) relevant? The current rule will only detect upper case "/BBB".
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)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