Ubuntu: How to make curl use proxy automatically


Today I configured the PC of my company to setup a proxy and it worked because I can wget web page via proxy.

What I did is set http_proxy, https_proxy and ftp_proxy in the ~/.bashrc and in the ~/.wgetrc.

However, when I tried to curl www.google.fr, it blocked and timeout.

curl --proxy $http_proxy www.google.fr worked as expected.

Is it possible to make curl use the proxy automatically?


Perhaps the easiest way to get curl to use a proxy is to add the details into ~/.curlrc. The syntax is as follows:

proxy = <proxy_host>:<proxy_port>  

This can alternatively be set as an environmental variable but IMHO using ~/.curlc is the most direct and least error prone method.

Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Next Post »