Added handling of https behind reverse proxy.