Forum Discussion
Simple I rule redirect
Hello,
I have created a vip that used http redirect to https. Right now I am using the default redirect irule
when HTTP_REQUEST {
HTTP::redirect https://[HTTP::host][HTTP::uri]
}
so basically when the customer types in the following
http://abc.com/wfc/logon it automatically redirects to
https://abc.com/wfc/logon
Fine no issues there.
The customer would like though to be also to type in the following and have it redirect like this.
http://abc/wfc/logon
and have that redirect to
https://abc.com/wfc/logon.
I tried doing it on the port 80 part of the vip with
when HTTP_REQUEST {
if { [HTTP::host] eq "abc" } {
HTTP::redirect "https://abc.com/wfc/logon"
}
}
That though did not work.
So do I put it on the 443 side on the vip. (I used the templates to set this up) or is my syntax screwed up here.
Thanks
Shawn
2 Replies
- Kevin_Stewart
Employee
I believe that SHOULD work. You may want to throw in some logging to see what the BIG-IPs sees as the [HTTP::host] value, but otherwise:when HTTP_REQUEST { if { [string tolower [HTTP::host]] equals "abc" } { HTTP::redirect "https://abc.com[HTTP::uri]" } else { HTTP::redirect https://[HTTP::host][HTTP::uri] } } - shawn306_84070
Nimbostratus
worked like a charm. Many Thanks !!!!!!
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)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