Skip to content

How to Test a Proxy with cURL in 3 Steps

Compare your public IP with and without an HTTP or SOCKS5 proxy. Learn how to verify the exit IP, check session behavior, and diagnose a failed connection.

lucas · · 9 min read
TimiData blog cover showing a cURL terminal, a proxy toggle, and an example exit IP in three pastel panels.

To test a proxy with cURL, send two requests to the same IP lookup service: one directly and one through the proxy. Compare the IP addresses returned by the service. If your proxy has an assigned exit IP, compare against that address too. This gives you a practical way to check the request path before adding it to a browser, script, or larger workflow.

What you need before testing

Have cURL, an active proxy connection, and its host, port, protocol, and authentication details ready. Use the host and port issued for the protocol you are testing. If you have a single connection string and need to identify its parts, see the TimiData proxy setup guide.

The examples run from a terminal and use a public IPv4 lookup service. On Windows, use curl.exe in PowerShell. Run curl --version or curl.exe --version first to confirm cURL is available. Keep both requests on the same machine and network. If a VPN or corporate gateway is active, your baseline will reflect the public address of that network path.

1. Record your public IP without the cURL proxy

Run the following command and save the value in the returned ip field.

curl -q --noproxy "*" --connect-timeout 10 --max-time 20 --fail --silent --show-error "https://api.ipify.org?format=json"

Putting -q first skips cURL’s default configuration file. The --noproxy "*" option tells cURL to connect directly, including when proxy environment variables are set. The timeout options limit how long cURL waits to connect and complete the request. If you get an error or no IP result here, check that the lookup service is reachable from your network before using it to diagnose the proxy.

2. Repeat the lookup through HTTP or SOCKS5

Run the command for your proxy protocol. Replace the example hostname, port, and username with the values issued for your connection. The example hosts and ports illustrate the format.

HTTP proxy

curl -q --proxy "http://proxy.example:8080" --proxy-user "YOUR_USERNAME" --connect-timeout 10 --max-time 20 --fail --silent --show-error "https://api.ipify.org?format=json"

The http:// prefix describes the connection to the proxy. The https:// in the final URL describes the destination. For this combination, cURL typically asks the HTTP proxy to establish a tunnel to the HTTPS destination.

SOCKS5 proxy

curl -q --proxy "socks5h://proxy.example:1080" --proxy-user "YOUR_USERNAME" --connect-timeout 10 --max-time 20 --fail --silent --show-error "https://api.ipify.org?format=json"

The h in socks5h:// tells cURL to let the proxy resolve the destination hostname. Use the host and port assigned to your SOCKS5 connection.

Check credentials and bypass settings

With only a username in --proxy-user, cURL prompts for the password in the terminal. If your provider uses IP allowlisting, make sure the public IP from Step 1 is the address you need to allowlist, and omit --proxy-user if the connection uses no username or password.

If your shell has a NO_PROXY or no_proxy environment variable, check whether it includes the lookup hostname or a wildcard. In Bash or zsh, you can add --noproxy '' to the proxied command to override that variable for the test. In PowerShell, you can run the proxied command in a session without those environment variables. This check matters when the proxied command returns your baseline IP.

3. Compare both IP results

Read the ip field from each response. In the example below, the destination observed a different address when the request went through the proxy. Both addresses are reserved for documentation.

Request Example response What the value represents
Direct {"ip":"192.0.2.24"} The baseline public address seen by the lookup service
Through the proxy {"ip":"203.0.113.42"} The public exit address seen by the same service on the proxied request

If the proxied result matches the assigned exit IP, you have confirmed that exit for this request. If the results differ and no fixed IP was assigned, record the observed proxy exit and compare it with any location or session requirement for your task. If both results match, check the bypass settings and inspect the connection details before deciding whether the proxy was used. The gateway hostname or address you configure and the public IP observed at the destination can differ.

Worked example: the terminal passes, but the browser shows your usual IP

Suppose your direct request returns 192.0.2.24, your cURL proxy request returns 203.0.113.42, and your browser still shows 192.0.2.24 on the same lookup service. You have evidence that the cURL request left through a different IP. Now check which browser profile is active and whether its proxy configuration excludes the lookup hostname. Test again inside that same profile, then repeat the check in the application you plan to use.

If the terminal and browser both show the expected proxy exit but a particular destination still fails, record the destination's response separately. An IP lookup verifies what the lookup service observed for that request. It does not verify that every destination is reachable, that every application uses the same route, or that the exit IP will stay fixed over time.

Troubleshoot a failed or unexpected result

Start with the first stage that fails. Add --verbose to the proxied command and look for the gateway connection, authentication, and the destination response. Redact account details and credentials before sharing diagnostic output.

Result What to check
cURL cannot resolve the proxy hostname Check the gateway name for typos and confirm it resolves from the machine running cURL. With SOCKS5 remote resolution, the client still needs to reach the proxy gateway.
Connection refused or timed out Recheck the gateway host, port, and protocol. Use the verbose output to see whether cURL reached the gateway. If the direct request also fails, start with the lookup service or your network connection.
HTTP 407 or a SOCKS5 authentication error Verify the username, password, and authentication method. If you use IP allowlisting, confirm the account permits your current public source IP.
The response shows the direct IP Check NO_PROXY and no_proxy, then use verbose output to confirm where cURL opened the connection. If it used the proxy, check whether your network and proxy may share the same public exit.
The exit IP differs from an assigned IP Recheck the selected connection and session parameters. Compare with the assigned exit address rather than the proxy gateway address.
cURL reports a TLS certificate error Identify which connection was being established when the error occurred. Check the hostname, system clock, and trusted certificates before repeating the test.

If cURL succeeds but your application still fails, run the lookup in that application as well. Confirm its active proxy profile, authentication, and bypass settings. A terminal test checks cURL’s connection, while the application test checks the configuration your workflow actually uses.

Check fixed IPs, sticky sessions, and IP rotation

Fixed IP. Run the proxied lookup again with the same connection details and compare both results with the assigned exit IP. Record the test time and the IP returned so you can reproduce a discrepancy later.

Sticky session. Repeat the lookup with the same session identifier within the session window documented for your plan. Keep the destination and connection settings the same. If the exit changes, check whether the session expired or the application regenerated the session identifier. Two cURL requests use the same sticky session ID and return the same example exit IP within the session window. Rotating session. Repeat the request using the rotation method supplied by your provider. If rotation is triggered by changing the session identifier, use fresh identifiers for the test. Log the session and returned IP for each request. An address can recur in a rotating pool, so judge the observed pattern across several requests instead of relying on one pair.

If country or city matters to your workflow, check the observed exit IP separately with an IP geolocation database. The public IP lookup used here returns an address. Location estimates, particularly at city level, can vary across databases.

Record enough information to repeat the test

Keep a short record of the application, proxy protocol, session mode, test time, direct result, and proxied result. Add the expected exit IP if your plan assigns one. For example, a useful entry would say that cURL used HTTP, the assigned fixed exit was 203.0.113.42, and the lookup returned that same address while the baseline returned 192.0.2.24. These are illustrative values. For a location-sensitive task, record the location reported by your chosen IP database and the region you requested.

A record like this also makes follow-up tests easier. If the same configuration works on your machine but fails on a server, check the server's own network path and credentials. If you use an IP allowlist, the server may reach the proxy from a different public address than your workstation.

What to verify before using the proxy in production

Once you have confirmed the exit behavior, make a single authorized request from your actual application to the destination it needs to reach. Record the proxy protocol, session mode, observed exit IP, and whether the intended request succeeded. This checks both the proxy connection and the destination that matters to your workflow.

If you are deciding between an assigned IP and configurable session behavior, compare TimiData’s public proxy options before choosing which connection to test.

Frequently asked questions

Can I test a proxy without installing a browser extension?

Yes. cURL can send a request through an HTTP or SOCKS5 proxy from the terminal. To verify a browser's own proxy settings, run the lookup from that browser afterward.

Should my proxy gateway and public exit IP match?

They can be different. The gateway is where your client connects. The exit IP is the address the destination sees. For a fixed-IP plan, compare the observed result with the assigned exit IP.

Why does my proxy IP change between requests?

Check whether you selected a rotating session, started a new session, or waited past the sticky session window. When investigating an unexpected change, use the same session parameters and record the time of each request.

Why do two IP lookup tools report different cities?

IP geolocation databases can map the same address to different cities. Compare the IP values first, then check the country or city against the location information available for your plan.

Does this test confirm my IP is hidden in every app?

The result describes the IP observed for one request. To confirm an app's behavior, run the lookup from that app and check whether its settings route the traffic you care about through the proxy.

lucas
Written by the author above and published by TimiData

Related articles