Turns out $_SERVER['REQUEST_SCHEME'] is only available on Apache 2.4
and later, $_SERVER['HTTPS'] is in the PHP documentation so is hopefully
always available. So HTTPS is the way to go.
Although, it is PHP so can never be sure.
http://stackoverflow.com/q/18008135/2434