Api call fails when on an https page