cURL -x Use of HTTP Proxy Server Examples

There can be certain reasons a software developer may need to reach out to an HTTP Request using a Proxy Server, to name a few,

  • For Testing or Debugging an API.
  • To Bypass the Load Balancer.
  • To Bypass the Network Restrictions

In such a case, we can make use of the -x option along with a cURL request. When the -x flag is used the request to the HTTP request is executed via the proxy server which acts as an intermediary server between the client and the website server.


curl -x <proxy_protocol>://<proxy_host>:<proxy_port> URL
curlThe command-line tool used to make HTTP/HTTPS/FTP/SFTP requests.
-xThe option to specify a proxy server.
<proxy_protocol>The protocol used by the proxy server, such as http, https, socks4, or socks5.http/https
<proxy_host>The hostname or IP address of the proxy
<proxy_port>The port number on which the proxy server is listening for incoming connections.8080
URLThe URL of the resource you want to access through the proxy.

Example: cURL -x HTTPS Proxy

curl -x
Curl -X Proxy HTTP Example

Facing issues? Have Questions? Post them here! I am happy to answer!

Author Info:

Rakesh (He/Him) has over 14+ years of experience in Web and Application development. He is the author of insightful How-To articles for Code2care.

Follow him on: X

You can also reach out to him via e-mail:

Copyright ยฉ Code2care 2024 | Privacy Policy | About Us | Contact Us | Sitemap