Curl With Proxy



  1. Curl With Proxy Command
  2. Curl With Proxy Protocol
  3. Curl Command With Proxy
  4. Curl With Proxy Authentication
  1. Curl has the best proxy support among many HTTP clients and download tools. This is how you use a socks5 proxy and also resolve hostname in the URL using the socks5 proxy. For some use case, resolving hostname via the proxy is essential. Suppose you have a socks5 proxy running on localhost:8001.
  2. For proxying HTTPS requests, set httpsproxy as well. Curl also allows you to set this in your.curlrc file (curlrc on Windows), which you might consider more permanent.

Curl is a command line tool and library which implements protocols like HTTP, HTTPS, FTP etc. Curl also supports HTTPS protocol which is secure version of the HTTP. Using curl may create some problems. We will examine how to solve these curl HTTPS related problems.

Using a proxy can be a good way to debug http issues. Unfourtunately setting the proxy on macOS globally does not apply to all command line utilities. On Curl for example you can set the proxy using the -proxy flag: curl -proxy 127.0.0.1:8080. Or by adding the following to your /.curlrc configuration file for a more persistent setting: proxy = 127.0.0.1:8080.

We will start with the installation of the curl tool with the following command.

Ubuntu, Debian, Mint, Kali:

Fedora, CentOS, RHEL:

Especial in self-signed or expired X.509 or SSL/TLS certificates may create problems. The error detail is printed to the terminal. As an example, we will try to access https://www.wikipedia.com and we will get an error like

AND we run following command.

Curl With Proxy Command

In order to prevent this error and accept an insecure certificate, we need to provide--insecure This will accept all provided certificates without complaining about it.

Curl With Proxy Protocol

Curl with proxy command

Curl Command With Proxy

If we do not want to use web site provided certificate and provide sites HTTPS certificate manually we can use -E or --cert option with the certificate file. In this example, we will use a certificate named inwk.cert order to connect https://www.wikipedia.com.

Curl With Proxy Authentication

In some cases, we may need to use another certificate chain then internet. Certificate chains provide a trust relationship between hierarchical certificates where the leaf is the site certificate we want to navigate. Certificate Authority is the top certificate which is provided by Certification Authority firms. We can provide another certificate authority like our company local certificate authority with the --cacert option.