I think this is the relevant part of irule
And looking at it now i guess it makes sense....the re-write from http://www.test1.com to https://www.test1.com/secure is picked up by this irule that knows /secure is HTTPS so it then does a redirect
( HTTP::respond 301 noserver Location "https://$requestedHost$requestedURI")
I'll need to figure out how to prevent this happening (perhaps a check to see whether referer = www.test1.com?)
REDIRECT HTTP to HTTPS
Check if URI is listed as requiring to be https and redirect is appropriate
} elseif {($protocol equals "HTTP") and ([class match -value $requestedURI starts_with $portalContextRoutingClass] equals "https")} {
set codeBlock "REDIRECT HTTP to HTTPS"
if {$debug >= 1} {
log local0. "$vsName : Debug Level $debug : $codeBlock : Redirecting to https://$requestedHost$requestedURI"
}
HTTP::respond 301 noserver Location "https://$requestedHost$requestedURI"
REDIRECT HTTP to HTTPS