Detect HTTPS properly.

We do it the same way as force-ssl now. Silly us.