curl: (35) error:1408F10B:SSL routines:ssl3_get_record:wrong version number

前端 未结 4 3847
清歌不尽
清歌不尽 2020-12-02 11:06

When I try to connect to any server (e.g. google.com) using curl (or libcurl) I get the error message:

curl: (35) error:1408F10B:SSL routines:ssl3_get

相关标签:
4条回答
  • 2020-12-02 11:14

    Simple answer

    If you are behind a proxy server, please set the proxy for curl. The curl is not able to connect to server so it shows wrong version number. Set proxy by opening subl ~/.curlrc or use any other text editor. Then add the following line to file: proxy= proxyserver:proxyport For e.g. proxy = 10.8.0.1:8080

    If you are not behind a proxy, make sure that the curlrc file does not contain the proxy settings.

    0 讨论(0)
  • 2020-12-02 11:20

    More simply in one line:

    proxy=192.168.2.1:8080;curl -v example.com

    eg. $proxy=192.168.2.1:8080;curl -v example.com

    xxxxxxxxx-ASUS:~$ proxy=192.168.2.1:8080;curl -v https://google.com|head -c 15 % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0

    • Trying 172.217.163.46:443...
    • TCP_NODELAY set
    • Connected to google.com (172.217.163.46) port 443 (#0)
    • ALPN, offering h2
    • ALPN, offering http/1.1
    • successfully set certificate verify locations:
    • CAfile: /etc/ssl/certs/ca-certificates.crt CApath: /etc/ssl/certs } [5 bytes data]
    • TLSv1.3 (OUT), TLS handshake, Client hello (1): } [512 bytes data]
    0 讨论(0)
  • 2020-12-02 11:26
    * Uses proxy env variable http_proxy == 'https://proxy.in.tum.de:8080'   
                                             ^^^^^
    

    The https:// is wrong, it should be http://. The proxy itself should be accessed by HTTP and not HTTPS even though the target URL is HTTPS. The proxy will nevertheless properly handle HTTPS connection and keep the end-to-end encryption. See HTTP CONNECT method for details how this is done.

    0 讨论(0)
  • 2020-12-02 11:40

    If anyone is getting this error using Nginx, try adding the following to your server config:

    server {
        listen 443 ssl;
        ...
    }
    

    The issue stems from Nginx serving an HTTP server to a client expecting HTTPS on whatever port you're listening on. When you specify ssl in the listen directive, you clear this up on the server side.

    0 讨论(0)
提交回复
热议问题