Forum Discussion
hooleylist
Nov 09, 2009Cirrostratus
You could replace the HTTP profile functionality for rewriting redirects with an iRule that inspects the Location header in redirects and only rewrites to https:// for your specific scenarios. If you have a lot of URIs to check you could add them to a datagroup. In this example, I've used a class named locations_to_preserve_class
when HTTP_RESPONSE {
Check if response is a redirect
if {[HTTP::is_redirect]}{
Save the Location header value to lowercase
set location [string tolower [HTTP::header Location]]
Check if the Location header value starts with http:// and is not one to preserve as http://
if {$location starts_with "http://" \
and not ([matchclass $location starts_with $::locations_to_preserve_class])}{
Replace http:// with https:// in the Location header
HTTP::header replace Location [string map "http:// https://" $location]
}
}
}
Aaron