Forum Discussion
cdougall_14195
Cirrus
Jun 24, 2011Help cleaning up IRule redirect with URI rewrite.
So, right up front, I'm an old router guy, so scripting is not my forte. The request is to have requests that come into a VIP be redirected to another URL, change the URI, but maintain all the quer...
cdougall_14195
Cirrus
Jun 27, 2011
Well, not really, and that's the part that I need some help with. The second lookup is used to cut out the part of the original URI that I want to remove.
So, from the original uri /abc?xxxxxxx I want to remove just /abc and replace it with new.hostname.name/def. The problem that I'm running into is getting a way to match just the /abc from the original call.
I've put some comments in below to show what I'm trying to do so that you guys can tell the right way to do it.
Thanks all,
Cameron
IRule:
when HTTP_REQUEST {
set urlredir [class match -value [HTTP::uri] starts_with DATA-GROUP]
[HTTP::uri] = old.host.name/abc?xxxxxxxxx
urlredir = new.host.name/def
if { $urlredir ne "" }{
set replace [class match -value $urlredir starts_with DATA-GROUP]
replace = old.host.name/abc without any of the passed arguments.
set redir [string map "$replace $urlredir" [HTTP::uri] ]
redir = the original uri where /abc is replaced with new.host.name/def
and become new.host.name/def?xxxxxxx
HTTP::redirect ""
then redirected.
}
}
Data external group:
"/abc" : = "new.host.name/def",
"new.host.name/def" : = "/abc",
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
DevCentral Quicklinks
* 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
Discover DevCentral Connects