Forum Discussion
Ravi_Rajan_7549
Nimbostratus
Apr 08, 2008HTTP to HTTPS redirect
Hi,
I want to have an irule to redirect all incoming traffic from http to https, host and the URI remaining the same.
I browsed through the forum and could not find the above. Please help in this.
Regards,
Ravi
7 Replies
- The_Bhattman
Nimbostratus
Here is an example. You apply this on VIP on port 80. This is assuming you have the same VIP on port 443when HTTP_REQUEST { HTTP::redirect "https://domain.com[HTTP::uri]" } - Girish_HS_32793
Nimbostratus
Posted By ravi.rajan on 04/07/2008 9:17 PM
Hi,
I want to have an irule to redirect all incoming traffic from http to https, host and the URI remaining the same.
I browsed through the forum and could not find the above. Please help in this.
Regards,
Ravi - Colin_Walker_12Historic F5 AccountIs there a reason you re-posted the original post as a quote? Did I miss something?
Colin - Ravi_Rajan_7549
Nimbostratus
Thanks all,
This is really helpful and working fine.
~Ravi - Ravi_Rajan_7549
Nimbostratus
Hi,
I encountering a a peculiar issue here using this irule.
I am using the rule as below -
when HTTP_REQUEST {
if {[matchclass [ string tolower [HTTP::uri] ] contains $::applist]} {
HTTP::redirect https://172.25.100.220[HTTP::uri] }
}
}
Now the issue is -
Applist contains a string of all virtual directories (IIS6) for ex. abc, pqr, test.
now i type the URL http://VIP1/xyz/per/ajskc/test.aspx
By the irule, the above should not match and should not redirect to HTTPS, but it is redirecting to HTTPS.
When i put a log statement in irule for [HTTP::uri], i got this value /xyz/per/ajskc/test.aspx
Can we modify the irule in someway so that i can strip the entire URI and consider only the first part for compare.
Require help urgently.
TIA,
Ravi - Nicolas_Menant
Employee
Hi,
to handle only the first part of the uri between "/" you should try to use the command getfield: Click hereset first_part [getfield [HTTP::uri] "/" 2] log local0. "first part is $first_part"
in your example: /xyz/per/ajskc/test.aspx first_part should be xyz - Ravi_Rajan_7549
Nimbostratus
Thanks,
I did it slightly the other way using findstr as below -
when HTTP_REQUEST {
if {[matchclass [findstr [ string tolower [HTTP::uri]] / 1 /] contains $::cls1apps]} {
HTTP::redirect http://172.25.103.252[HTTP::uri] }
}
Thanks,
Ravi
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
