fix bug where running under node would sometimes use http when should use https
fix bug where running under node would sometimes use http when should use https