Skip to content

SSL IP address mismatch error via ssh tunnel (But curl works) #2513

Closed

Description

@funkindy

Hi. I have a client-side *.pem to access remote server. Because of the server IP whitelist i use ssh port proxy via trusted host. So the target url on my local machine is https://127.0.0.1:someport/endpoint

I init AsyncClient with verify=httpx.create_ssl_context(cert="certfile.pem", verify=False) to disable all cert verifications, but i still get this error: httpx.ConnectError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: IP address mismatch, certificate is not valid for '127.0.0.1'. (_ssl.c:1131)

the strange part is that curl works just fine in exactly the same environment. Curl command:

curl https://127.0.0.1:someport/endpoint --cert "certfile.pem" --insecure

Is there any different between httx's verify=False and curl's --insecure maybe? Or am i missing something obvious?

Thank you.

Activity

  1. lovelydinosaur commented on Dec 26, 2022

    @lovelydinosaur
    Member

    Were you missing something obvious?

  2. funkindy commented on Dec 26, 2022

    @funkindy
    Author

    Were you missing something obvious?

    Yes, i've passed a custom transport to AsyncClient, which overrides client level verify arg (should provide ssl context directly to the transport instance). Maybe a kind of a warning could help but its ok.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions