Forum Discussion
Brendan_Hogan_9
Nimbostratus
Apr 21, 2006Cannot get redirect to work
Desired result:
If HTTP_REQUEST is http or https
output = https.
Also, if URI is "/", then append "/ps/signon.html"
The following works as long as request is http and not https:
when HTTP_REQUEST {
if { [HTTP::path] equals "/" } {
HTTP::redirect "/ps/signon.html"}}
How do I get this to also function for https requests?
The following works for the https to http redirect:
when HTTP_REQUEST {
HTTP::redirect "https://[HTTP::host]/ps/signon.html"
}
How do I get both to work in one statement or is there a better way to accomplish this? I would guess this is a simple irule to create for someone who has a clue but that is not me :-)
Thanks!
- Colin_Walker_12Historic F5 AccountWell, first of all, to be able to read the path information of an SSL encrypted HTTP request via an iRule, you have to make sure that your BIG-IP is set to terminate SSL for the connection.
when HTTP_REQUEST { if { [HTTP::path] equals "/" } { HTTP::redirect "https://[HTTP::host]/ps/signon.html" } }
- Brendan_Hogan_9
Nimbostratus
The SSL profile is setup correctly as far as I can tell - if I go to https://domain.edu/ps/signon.html it is exactly the page that should be displayed. - JRahm
Admin
Try this:when HTTP_REQUEST { if { [HTTP::path] equals "/" } { HTTP::redirect "https://[HTTP::host]/ps/signon.html" } elseif { ([TCP::local_port] == 80) && ([HTTP::uri] eq "/ps/signon.html")} { HTTP::redirect "https://[HTTP::host]/ps/signon.html" } }
- Colin_Walker_12Historic F5 AccountWell, it should be pretty straight forward, using a basic redirect rule like that. You just need to be sure it's enabled on the proper VIP (the 443 virtual), and that the rule is matching the proper URI. You might try adding a couple of log statements to see what the HTTP::path variable is returning on your requests to see why the redirect isn't being executed.
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