Forum Discussion
URL redirtion not happning through Irule.
Hi All,
I am using simple Irule to redirect Url.
when HTTP_REQUEST { if { [string tolower [HTTP::host]] equals "abc.com" } { HTTP::redirect "https://abc.com/welcome/do" } }
i attached this i rule to standard Virtual server for port 80. HTTP profile is enabled.
But at the time of testing URL redirection not happening....page opening without redirection i.e abc.com.
Please help what i am missing...?
7 Replies
- nitass
Employee
can you do some debugging?
iRules 101 - 09 - Debugging by Joe Pruitt
https://devcentral.f5.com/articles/irules-101-09-debugginghttp analyzer tool may be helpful.
HttpFox
https://addons.mozilla.org/en-us/firefox/addon/httpfox/ - Hannes_Rapp
Nimbostratus
If you use multiple iRules, another possible cause would be a TCL error (e.g. due to multiple redirect invocations). Take a brief look at the /var/log/ltm file as you initiate a connection. If this happens to be the case, use the
command after each redirect statement to ensure no more than one BigIP redirect will be invoked per request.event disable- Arie
Altostratus
Good point, but wouldn't `event disable` risk disabling other (required) functionality? I usually implement a semaphore to prevent multiple responses.
- Hannes_Rapp_162
Nacreous
If you use multiple iRules, another possible cause would be a TCL error (e.g. due to multiple redirect invocations). Take a brief look at the /var/log/ltm file as you initiate a connection. If this happens to be the case, use the
command after each redirect statement to ensure no more than one BigIP redirect will be invoked per request.event disable- Arie
Altostratus
Good point, but wouldn't `event disable` risk disabling other (required) functionality? I usually implement a semaphore to prevent multiple responses.
- giltjr
Nimbostratus
Depending on how your F5 is setup, wouldn't this cause a endless loop? You are only checking for the host name of abc.com and then redirecting to a specific URI at abc.com (https://abc.com/welcome/do).
I would think you may want to check for the URI just equal to "/" and the host name abc.com.
- Arie
Altostratus
Something else you may want to consider (not related to the problem) is using a 301 instead of a 302.
Instead of
HTTP::redirect "https://abc.com/welcome/do"I would recommend
HTTP::respond 301 Location "https://abc.com/welcome/do"
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
* 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