Forum Discussion
thecompguru_206
Nimbostratus
Jun 16, 2015Traffic Redirection
Sorry if this is a very greenhorn question but i'm just getting started with the irules in the F5 and wanted to know what the script would look like for the redirect i'm going for. I want to do a URL...
Hannes_Rapp
Nimbostratus
Jun 16, 2015when HTTP_REQUEST {
if { ([HTTP::host] == "irule.sample.com") && ([HTTP::path] == "/" )}{
HTTP::respond 302 location "https://irule.newsample.com/launcher/irule" Invokes a temporary 302 redirect, replace with 301 if you want permanent instead.
event disable Recommended function, if you use other iRules that also utilize the HTTP_REQUEST event.
TCP::close Recommended because it resolves the issue with redirect not functioning from the second web-browser tab if already invoked more than once. (issue applies to Chrome and HTTP/1.1).
}
}
Test it out. I've added some comments to help you understand the lines. You will need to apply the iRule to your TCP/443 port listener Virtual Server. Also for the iRule to work, your VS must have a clientside SSL profile configured as well as a HTTP profile.
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)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