Curl proxy example

Using a proxy with cURL involves passing the appropriate command-line options to the cURL tool. A proxy can help route your network requests through an intermediary server, providing various benefits like anonymity, security, and access to geographically restricted content.
Here's how you can use a proxy with cURL:
Basic Proxy Usage

To use a proxy with cURL, you can use the --proxy or -x option followed by the proxy address and port. For example, if the proxy is located at on port 8080, you would use the following command:
curl --proxy

Curl HTTP Proxy

If you're using an HTTP proxy, you can specify the proxy type explicitly using the --proxy-type option, here is an example:
curl --proxy --proxy-type http

Curl SOCKS Proxy

For SOCKS proxies, use the --proxy-type option with the value socks4 or socks5, here is an example:
curl --proxy socks5://

Curl proxy username password

If your proxy requires authentication, you can pass the username and password using the -U or --proxy-user option:
curl --proxy -U username:password

Curl bypass proxy

If you want to bypass the proxy for specific domains, you can use the --noproxy option:
curl --proxy --noproxy


If your proxy supports HTTPS, you can use it by specifying https in the proxy URL:
curl --proxy

Environment Variables

Alternatively, you can set the proxy using environment variables:
export http_proxy="" export
https_proxy="" curl

Remember to adjust the proxy URLs accordingly for different proxy types.

Using a proxy with cURL can greatly expand your networking capabilities by allowing you to route requests through different servers for various purposes. Whether you’re seeking enhanced security, improved performance, or access to region-restricted content, leveraging a proxy with cURL can be a powerful tool in your networking toolkit.

Scroll to Top