Forum Discussion
jmartinez_44554
Nimbostratus
Aug 03, 2015How to parse a guid from a uri to using in a redirection
I need to keep the guid of a uri and redirect to a new uri using the guid
Whats the best way to accomplish this.
original uri:
en/server/GUID-876D26ED-3B49-41EB-8470-78D3F60F1360addHistory=...
VernonWells
Employee
Aug 03, 2015Sorry, I posted the previous comment then saw your follow-up. Unfortunately, the URI you provide isn't really legal, and the
HTTP:: handling primitives are sensitive to this fact. If you cannot alter this client behavior, then it looks like you will have to bypass the HTTP events and primitives and directly read the data.
when CLIENT_ACCEPTED {
TCP::collect
}
when CLIENT_DATA {
set guid [findstr [TCP::payload] "docid=" 6 &]
TCP::release
}
when HTTP_REQUEST {
if { [info exists guid] && $guid ne "" } {
HTTP::redirect "http://host.example.com/en/server/$guid"
}
}
This assumes the entire request URI can be found in the first TCP segment. If you want it to be more robust, you'll have to expand on the logic a bit.
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