Recognize https behind a proxy

Fix problem when the web server is behind an ssl termination proxy (http://en.wikipedia.org/wiki/SSL_termination_proxy)