Adding scheme="https" prevents the exception, but the redirect from http to https is still not happening.