How to Test a Proxy with cURL (HTTP and SOCKS5)

If your app won’t connect through a proxy, try the same connection from a terminal. All you need to start is the proxy address and an IP lookup. Run one request directly and one through the proxy so you have two addresses to compare.

Laptop showing an illustrative terminal beside a network gateway connected by a cable

Find your IP before using the proxy

Run this on the machine where the proxy needs to work. If your app runs on a server, open a terminal there. In Windows PowerShell, use curl.exe if curl opens a PowerShell cmdlet.

curl --disable --noproxy "*" --fail --silent --show-error --max-time 20 "https://testmyproxies.com/api/my-ip"

Write down the ip value from the response. The * tells cURL to go directly even if your environment has a proxy set. In the next commands, replace the example host and port with your proxy’s details.

Try the HTTP proxy

curl --disable --noproxy "" --proxy "http://gateway.example:8080" --fail --silent --show-error --max-time 20 "https://testmyproxies.com/api/my-ip"

If the proxy needs a password, add --proxy-user with your username. cURL prompts for the password so you can leave it out of the command you paste.

curl --disable --noproxy "" --proxy "http://gateway.example:8080" --proxy-user "demo-user" --fail --silent --show-error --max-time 20 "https://testmyproxies.com/api/my-ip"

The empty --noproxy list tells cURL to use the proxy even if a bypass rule normally applies. If your provider calls for TLS to the proxy itself, use https:// in the proxy address and the hostname on its certificate. Keep the IP lookup URL as it is. How HTTP, HTTPS and SOCKS5 proxies differ

Try the SOCKS5 proxy

curl --disable --noproxy "" --proxy "socks5://socks-gateway.example:1080" --fail --silent --show-error --max-time 20 "https://testmyproxies.com/api/my-ip"

With socks5://, your machine looks up the site’s IP. If your app asks the proxy to do the DNS lookup, try socks5h:// to match that behavior.

curl --disable --noproxy "" --proxy "socks5h://socks-gateway.example:1080" --fail --silent --show-error --max-time 20 "https://testmyproxies.com/api/my-ip"

When you enter the same proxy in the online tester, use socks5://. SOCKS protocols and DNS in cURL

Check which IP came back

Say the response includes "ip":"203.0.113.24". Compare that address with the one from your first request and with the exit your provider gave you. If the proxy rotates, repeat the test a few times with the same session settings and jot down each address.

If cURL returns an error

  • HTTP 407 or SOCKS authentication failed. Re-enter the credentials. If your provider uses IP authorization, check that the public IP from your direct request is allowed.
  • Could not resolve proxy or failed to connect. Check the proxy hostname and port. If the proxy connects and only the destination lookup fails, see where SOCKS5 is doing DNS.
  • TLS error or timeout. For a certificate error, check the hostname and whether TLS is failing at the proxy or at the destination. For a timeout, check whether the proxy host and port are reachable and try the same destination directly.

If cURL works and the app still fails, compare its proxy scheme, bypass rules and DNS settings. For a browser, check the exit IP in your usual profile. If the online test fails too, start with the error reported by the tester. cURL option reference

All proxy testing guides · Open the proxy tester