Forum Discussion
rade5_74503
Nimbostratus
Jan 03, 2019Irule - For redirection
How can I create an irule for redirection
https://www.test.com/promotion.jsp!/fanta-manager to https://www2.test.com/scommesse
This is what I have at the moment (Does not work)
when HT...
CoolPolishGuy
Nimbostratus
Jan 03, 2019Hello
I would use path instead of uri as you are only interested in a specific part of the uri. When you are not sure of what the objects are containing, you can always print them and check the /var/log/ltm and see how your iRule did behave. Be sure that the iRule is correctly applied to your VIP.
To print logs use the following
log local0. "my iRule is working"
set uri [HTTP::uri]
log local0. $uri
`
You also use "contains" and to match the host or other elements. In general it looks legit what you did.
`when HTTP_REQUEST {
if { (([string tolower [HTTP::host]] equals "www.test.com") and ([string tolower [HTTP::path]] contains "/fanta-manager"))} {
HTTP::redirect "https://www2.test.com/scommesse"
}
}
Take out the semi colons also.
Very important is to check the logs and you will very quickly see what the problem is.
Hope it helps
Cheers
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
