cquick11_115408
May 17, 2013Nimbostratus
Irule Help with redirection
I created an irule to redirect from http:https and vice versa based on creteria from our development team; however some of the checkout pages aren't rendering correctly because they are staying in http on the secure page. They gave me a list of other patterns to check, so that if the page is in https, use https. My code is not working correctly:
I have two VS, http and https, they both have http profiles and it's doing ssl termination. I am using data groups:
List of mixed-mode URL patterns:
/services/*
*/qas_proxy*
URL Extension List:
.aspx
.html
.htm
.svc
List of secure URL patterns:
/checkout*
*/orderconfirmation*
/accountinformation*
/login*
/register*
VS:http
when HTTP_REQUEST {
if { [class match [HTTP::uri] starts_with mixed_mode] } {
pool POOL_CHD-Stage-Web
log local0. "mixed_mode Request:[HTTP::method] [HTTP::host][HTTP::path] URI: [HTTP::uri]"
} elseif { [class match [HTTP::path] equals file_extensions] } {
pool POOL_CHD-Stage-Web
log local0. "file_extensions Request:[HTTP::method] [HTTP::host][HTTP::path] URI: [HTTP::uri]"
} elseif { [class match [HTTP::uri] starts_with secure_uris] } {
HTTP::redirect https://[getfield [HTTP::host] ":" 1][HTTP::uri]
log local0. "Secure_Uris Request:[HTTP::method] [HTTP::host][HTTP::path] URI: [HTTP::uri]"
}
}
VS:HTTPS
when HTTP_REQUEST {
if { [class match [HTTP::uri] starts_with mixed_mode] } {
pool POOL_CHD-Stage_443
log local0. "mixed_mode Request 443:[HTTP::method] [HTTP::host][HTTP::path] URI: [HTTP::uri]"
} elseif { [class match [HTTP::path] equals file_extensions] } {
pool POOL_CHD-Stage_443
log local0. "file_extensions Request 443:[HTTP::method] [HTTP::host][HTTP::path] URI: [HTTP::uri]"
} elseif { not [class match [HTTP::uri] starts_with secure_uris] } {
HTTP::redirect http://[getfield [HTTP::host] ":" 1][HTTP::uri]
log local0. "Secure_Uris Request 443:[HTTP::method] [HTTP::host][HTTP::path] URI: [HTTP::uri]"
}
}