Forum Discussion
iRules appending after url
Generic http to https redirect, retaining the original URI of the request for http virtual server:
when HTTP_REQUEST {
HTTP::respond 301 Location "https://abc.com[HTTP::uri]"
}
https redirect to default page within https, for https virtual server:
when HTTP_REQUEST {
if { [HTTP::path] equals "/"} {
HTTP::respond 301 Location "https://abc.com/something"
}
}
Just to summarize, so I have to create two irules, one for the redirection of http traffic to https and other for adding "/something" at the end of the URL.
- wlopezFeb 12, 2020Cirrocumulus
The iRule for the http virtual server will cover the redirects to https for all requests. That will help mitigate situations like if someone forgets to type https on their browser. Without it they would get a timeout.
The iRule for the https virtual server will simply make sure that if someone types the URL, they get redirected to the website's initial landing/login page. For example, if someone types 'https://abc.com', without the iRule they would be sent to the default setup on the servers. If you don't have any programing on the servers to redirect requests to path '/' to the initial login page '/web/login.php'. With the iRule the F5 will make sure that requests to the default path '/' get redirected to '/web/login.php', while leaving requests to any other paths intact.
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