v1.10.90-0e025b8
Skip to main content
← Back to Hex Proxies

curl Proxy Integration

Test Hex Proxies quickly using curl with proxy authentication.

curl Proxy Setup

curl is the most widely used command-line tool for making HTTP requests. It comes pre-installed on macOS, Linux, and modern Windows systems. curl is ideal for quick proxy testing, debugging connection issues, and verifying that your Hex Proxies credentials work before integrating into a larger application.

Basic HTTP Proxy with Authentication

curl -x http://gate.hexproxies.com:8080 -U user:pass https://httpbin.org/ip

This routes the request through Hex Proxies and returns the proxy's IP address.

Using Inline Credentials

You can embed credentials directly in the proxy URL:

curl -x http://user:pass@gate.hexproxies.com:8080 https://httpbin.org/ip

IP Whitelist Authentication

If your IP is whitelisted in the Hex Proxies dashboard, no credentials are needed:

curl -x http://gate.hexproxies.com:8080 https://httpbin.org/ip

SOCKS5 Proxy

curl -x socks5h://user:pass@gate.hexproxies.com:1080 https://httpbin.org/ip

Use `socks5h` to resolve DNS through the proxy (prevents DNS leaks).

Geo-Targeted Requests

Append country codes to your username:

curl -x http://gate.hexproxies.com:8080 -U user-country-jp:pass https://httpbin.org/ip

Verbose Debugging

curl -v -x http://gate.hexproxies.com:8080 -U user:pass https://httpbin.org/ip

The `-v` flag shows the full connection flow including proxy CONNECT handshake, TLS negotiation, and response headers — essential for diagnosing issues.

Setting Proxy via Environment Variables

export http_proxy=http://user:pass@gate.hexproxies.com:8080

curl https://httpbin.org/ip # Automatically uses the proxy ```

Best Practices

  • **Use -v for debugging** connection issues — it reveals exactly where the request fails.
  • **Set timeouts** with `--connect-timeout 10 --max-time 30` to avoid hanging requests.
  • Test before integrating — verify proxy connectivity with curl before adding proxy config to your application code.

Troubleshooting

  • **407 Proxy Authentication Required**: Check username and password. Special characters in the password may need URL encoding.
  • **Connection refused**: Verify the proxy host and port. Ensure your firewall allows outbound connections on port 8080.
  • **SSL certificate errors**: Try `--insecure` for testing (not for production). Update your CA bundle if certs are outdated.
  • **Empty response**: Add `--max-time 30` to set a timeout. Residential proxies may take 1-3 seconds to respond.

Integration Steps

1

Set proxy endpoint

Use -x with the proxy server host and port.

2

Add credentials

Pass -U user:pass for auth.

3

Test target

Run a request to confirm connectivity.

Operational Tips

Keep sessions stable for workflows that depend on consistent identity. For high-volume collection, rotate IPs and reduce concurrency if you see timeouts or 403 responses.

  • Prefer sticky sessions for multi-step flows (auth, checkout, forms).
  • Rotate per request for scale and broad coverage.
  • Use timeouts and retries to handle transient failures.

Frequently Asked Questions

How do I use SOCKS5 with curl?

Use -x socks5h://host:port with your credentials.

Ready to Integrate?

Start using residential proxies with curl today.