Fix: "HTTPS redirects to HTTP when logging in"

Fix provided by: Robin Breathe (from the Bug forums)

This also fixes the bug which confused django's intenal is_secure() function
to believe that we are using 'http' when infact we were on 'https'
when in the dual 'http+https" gui mode of operation.

Ticket: #6796