Forum Discussion
Add the URI in the redirect URL when the HTTP Response is 404 code
Hi SS1,
Request : https://www.example.com/path1/path2?param=value
Host : www.example.com
Uri : /path1/path2?param=value
Path : /path1/path2
Query : param=value
https://clouddocs.f5.com/api/irules/HTTP__host.html
https://clouddocs.f5.com/api/irules/HTTP__uri.html
https://clouddocs.f5.com/api/irules/HTTP__path.html
https://clouddocs.f5.com/api/irules/HTTP__query.html
when HTTP_REQUEST {
set uri [string trimleft [HTTP::uri] "/"]
}
when HTTP_RESPONSE {
if { [HTTP::status] == 404} {
HTTP::redirect "http://test123/?abcd=$uri"
}
}You need trim first slash.
https://devcentral.f5.com/s/articles/irules-101-14-tcl-string-commands-part-2
Its redirecting to
fdfbglskbvksdfbvlk URI appened in redirect URL but it should be https://test123/?abcd=fdfbglskbvksdfbvlk
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