I had a similar problem with a custom ASPX page I put into a module I created. The DNN URLRewriter will redirect any non-core ASPX to a non-secure page; this includes KeepAlive.aspx. My custom ASPX writes out images from a database which I use for branding on even secure pages, so what would happen is it would redirect them from an SSL page to a non-SSL page and break the image display.
Essentially the URLRewriter doesn't like it when ASPX pages are referenced via SSL which are not marked as secure. When it sees this it redirects them back to an HTTP version of the page. This behaviour happens if you enable SSL Enforced.
A solution, but not viable one, was to deselect the SSL Enforced? option. This appears to solve it, but why this won't work is that once a user accesses a secured page (Login for example) they will never get switched back to HTTP for the life of their visit. They will be on SSL from that moment forward. A solution that I've implemented:
Disable SSL Enforced, and then I created a simple module which I put it at the bottom of all pages which contains the following code in the Page_Load:
' Page Secure?
If Me.Request.IsSecureConnection Then
' Make sure it's supposed to be secure
If Not PortalSettings.ActiveTab.IsSecure Then
' It's not, so redirect
' Build
Dim sServerName = Request.ServerVariables("SERVER_NAME")
Dim sScriptName = Request.ServerVariables("SCRIPT_NAME")
Dim sQuerystring = Request.ServerVariables("QUERY_STRING")
Response.Redirect("http://" & sServerName & sScriptName & "?" & sQuerystring)
End If
Else
' Hide module so it doesn't take space
Me.Visible = False
End If
You can now access KeepAlive.aspx via HTTPs and it won't redirect. Your pages marked secure stay secure, and pages not marked secure auto-redirect to a non-HTTPS version. The only side effect from this is that anyone can use HTTPS on a page and of course if you login and use Admin pages it won't switch out of HTTPS, but some people would view this as a good thing since from that point forward Admin is secure.
For those unfamiliar with how to make a module I've attached it at the following URL:
www.keithadler.info/SSL_Fix.zip