Forum Discussion
iRule for URL redirect
Hello,
Can someone please help me with an iRule for URL redirection.
Source URL - https://test.test.com/navigator/bookmark.jsp?desktop=Invoice&docid={C2827ADC-C4B5-4B62-9024-C7848E7CAF5F}
Target redirect URL - https://test.test.com/linkredirectservice/drl?desktop=Invoice&docid=%7BC2827ADC-C4B5-4B62-9024-C7848E7CAF5F%7D
Note - Target URL redirect has docid value which need sto be taken from the source URL and also the { and } in the source URL docid value needs to be conver their ascii values accordingly.
Thanks in advance!
- JonathancertNimbostratus
I'm just learning iRules myself but will try to help. There should be a pre-installed redirect Irule on the LTM. I found one named "_sys_https_redirect". Looks like this.
# Copyright 2003-2006, 2012-2013, 2016, 2019. F5 Networks, Inc. See End User License Agreement ("EULA")
# for license terms. Notwithstanding anything to the contrary in the EULA,
# Licensee may copy and modify this software product for its internal business
# purposes. Further, Licensee may upload, publish and distribute the modified
# version of the software product on devcentral.f5.com.
#
when HTTP_REQUEST {
HTTP::redirect https://[getfield [HTTP::host] ":" 1][HTTP::uri]
}Below is one of my companies redirects.
when HTTP_REQUEST {
if { [string tolower [HTTP::host]] equals "????.com" } {
HTTP::respond 301 Location "https://???.com[HTTP::uri]"
}
}Hope this helps.
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