Forum Discussion
Dbow_21284
Nimbostratus
Feb 12, 2008Redirecting back and forth between HTTP and HTTPS virtual servers for the same site
Hello,
I have a site that we are about to use F5 Big-IP LTM to load balance. I am a little green though and I need some assistance with creating iRULES to redirect back and forth between th...
hoolio
Cirrostratus
Feb 13, 2008You could create a string datagroup (in the GUI under Local Traffic >> iRules >> Datagroup tab) containing the full paths you want accessed only via HTTPS. Then for the HTTP virtual server, use a rule to redirect all requests to these paths to HTTPS. If you only wanted to allow HTTPS requests to the HTTPS VIPs for those paths, you could redirect all others to HTTP using a second rule on the HTTPS VIP.
Datagroup (called a class in the bigip.conf):
secure_paths_datagrup:
/path/to/file.ext
/path/to/another.file.ext
/path/to/someother.file.ext
HTTP rule:
when HTTP_REQUEST {
Check if request is to a secure URI
if {[matchclass [HTTP::path] equals $::secure_paths_datagroup]}{
Redirect request via HTTPS
HTTP::redirect https://[HTTP::host][HTTP::uri]
}
}HTTPS rule:
when HTTP_REQUEST {
Check if request is not to a secure URI
if {not ([matchclass [HTTP::path] equals $::secure_paths_datagroup])}{
Redirect request via HTTP
HTTP::redirect http://[HTTP::host][HTTP::uri]
}
}Aaron
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
