29-Oct-2020 13:56
We need to configure an IRule in F5 for redirecting URL. The source URL will have an object id in its URI which we need to fetch and append it in the destination URL.
Source URL can come in two formats as shown below and object id in it is highlighted in bold.
http://mytest.mytest.com/webtop/drl/objectId/0900e6cc814a810c/chronicleId/0900e6cc814a810c/versionLabel/CURRENT
http://mytest.mytest.com/webtop/drl/objectId/0900e6cc81095ef9/chronicleId/0900e6cc81095ef9
We need to fetch the object id (0900e6cc814a810c and 0900e6cc81095ef9) from above sample URL and append it in destination redirect URL as shown below
https://redirect.mytest.com/api/LinkServ?objectID=”WebtopObject ID”
https://redirect.mytest.com/api/LinkServ?objectID=”0900e6cc814a810c ”
30-Oct-2020
09:02
- last edited on
04-Jun-2023
21:12
by
JimmyPackets
You can use the getfield option to extract that objectid, something like, if there are multiple other hosts coming to this setup, you can add host condition and then take action too.
ltm rule objectid_redirect {
when HTTP_REQUEST {
set uri [HTTP::uri]
set id [getfield $uri "/" 5]
log local0. "ObjectID is $id"
HTTP::redirect https://redirect.mytest.com/api/LinkServ?objectID=$id
}
}
Hope it helps. Test & update us.
03-Nov-2020
06:31
- last edited on
24-Mar-2022
01:06
by
li-migration
Thank you !!! We are still testing different scenarios but looks like it is working as expected.
03-Nov-2020 20:39
Glad could be of help, Please mark thread closed if resolved.