# Proxy Chaining: How It Works, Tested With curl

> Proxy chaining sends a request through two or more proxies in a row. We chained a mobile and a residential proxy with one curl command and read the exit.

[Home](https://quanticdata.io/) / [Blog](https://quanticdata.io/blog/) / Proxy Chaining: How It Works, Tested With curl

# Proxy chaining: two proxies in a row, and which IP the site sees

Proxies · Nov 20, 2026 · 5 min read · By [Aldo Morese](https://quanticdata.io/about/), founder of QuanticData

![A two-proxy chain built with one curl command: the request goes from a PC in Italy to a mobile proxy over SOCKS5, then through a residential proxy in Germany over HTTP, and the website sees only the last exit, a home IP in Lower Saxony; the card lists the exit ipinfo.io saw for each setup: Orlando on T-Mobile for the mobile proxy alone, and Lower Saxony on EWE TEL for the chain.](https://quanticdata.io/blog/proxy-chaining/hero.webp?v=20261120h)

On this page

- [How a proxy chain works](https://quanticdata.io/blog/proxy-chaining/#how-a-proxy-chain-works)
- [Chain two proxies with one curl command](https://quanticdata.io/blog/proxy-chaining/#chain-two-proxies-with-one-curl-command)
- [Mistakes to avoid when chaining in curl](https://quanticdata.io/blog/proxy-chaining/#mistakes-to-avoid-when-chaining-in-curl)
- [When chaining proxies is useful](https://quanticdata.io/blog/proxy-chaining/#when-chaining-proxies-is-useful)
- [Proxy chaining vs VPN](https://quanticdata.io/blog/proxy-chaining/#proxy-chaining-vs-vpn)
- [Proxy chaining on Windows and Linux](https://quanticdata.io/blog/proxy-chaining/#proxy-chaining-on-windows-and-linux)
- [Which networks to put in a chain](https://quanticdata.io/blog/proxy-chaining/#which-networks-to-put-in-a-chain)

Proxy chaining sends a request through two or more proxy servers in a row. Your device connects to the first proxy, which connects to the second, which reaches the site. The site sees only the last proxy's IP, and each proxy talks only to its neighbours. In curl, `--preproxy` plus `-x` builds a two-hop chain.

**Run it on the free credit.** Every QuanticData account gets $2 of free API usage per month.

[Start free — $2/month included](https://quanticdata.io/signup/?utm_source=blog&utm_medium=website&utm_campaign=blog-lead&utm_content=proxy-chaining) · [Explore Residential Proxies from $0.80/GB](https://quanticdata.io/residential-proxies/)

We built one on a Windows 11 PC on 20 November 2026 with curl 8.21.0, chaining a QuanticData mobile proxy and a residential proxy, and read which exit the site saw. Exit IPs are masked.

## How a proxy chain works

Each hop opens a tunnel inside the previous one. With an HTTP proxy, the client sends `CONNECT host:port` and the proxy opens a TCP connection there; with SOCKS5 the request is the same in binary form. In a chain, the "host" of the first request is the second proxy:

1. Your PC opens a SOCKS5 connection to proxy 1 and asks it to connect to proxy 2.
2. Through that tunnel, your PC sends proxy 2 a `CONNECT ipinfo.io:443` with proxy 2's login.
3. Proxy 2 connects to the site. TLS runs end to end, from your PC to the site, through both tunnels.

| Who | Sees your IP | Sees the site name | Sees the page content (HTTPS) |
| --- | --- | --- | --- |
| Proxy 1 | Yes | It connects to proxy 2's address; the CONNECT line for the site passes through it unencrypted | No |
| Proxy 2 | No, it sees proxy 1's exit | Yes | No |
| The site | No, it sees proxy 2's exit | Yes | Yes |

## Chain two proxies with one curl command

curl takes a first hop with `--preproxy` (a SOCKS proxy) and a second hop with `-x`. We put a Mobile line first, over SOCKS5, and a Residential Premium line in Germany second, over HTTP:

```bash
curl --preproxy socks5h://USER:PASS@mobile.quanticdata.io:1080 \
     -x http://USER-country-de-sid-cn01-ttl-30m:PASS@residentialpremium.quanticdata.io:8080 \
     https://ipinfo.io/json
{
  "ip": "x.x.x.x",
  "city": "Wallenhorst",
  "region": "Lower Saxony",
  "country": "DE",
  "org": "AS9145 EWE TEL GmbH",
  "timezone": "Europe/Berlin"
}
```

The site saw a German home line, the exit of the second hop. The mobile hop in front of it, which on its own had left from a T-Mobile IP in Orlando, Florida, did not appear anywhere in the answer. `socks5h` lets the first proxy resolve the second proxy's name, so the lookup does not happen on your line either; why that matters is in our [DNS leak test through a proxy](https://quanticdata.io/blog/dns-leak-test-proxy/).

## Mistakes to avoid when chaining in curl

- **An HTTP proxy in `--preproxy`.** The first hop must be SOCKS. When we put an HTTP proxy there, curl stopped with `curl: (5) Unsupported pre-proxy type for 'http://...'` and sent nothing. Use a SOCKS5 line first, as in our test with Mobile, and an HTTP line second.
- **Two logins in one place.** Each hop has its own username and password, written in its own URL. The second login travels through the first hop inside the tunnel, unencrypted, so put only proxies you trust in a chain.
- **Checking the wrong IP.** The exit you read on ipinfo.io is the last hop's. To check the first hop alone, run the same request with only `-x` and the first proxy, as we did before building the chain.
- **`socks5` instead of `socks5h`** in the first hop. The chain still works, and our test with plain socks5 still reached a German exit, but your own line then looks up the second proxy's name.

Each hop adds its own time, so add a hop only when it does a job.

**Try it on your own targets.** Every QuanticData account gets $2 of free API usage per month.

[Start free — $2/month included](https://quanticdata.io/signup/?utm_source=blog&utm_medium=website&utm_campaign=blog-inline&utm_content=proxy-chaining) · [Explore Residential Proxies from $0.80/GB](https://quanticdata.io/residential-proxies/)

## When chaining proxies is useful

- **A company network that only lets traffic out through its own proxy.** That proxy becomes hop 1 and your proxy service hop 2; the "proxy chaining" settings of corporate gateways exist for this.
- **Testing.** Checking how a site or an app behaves when traffic arrives through more than one intermediary.

For the usual goals, one good hop is enough. To make a site see a home or mobile IP in a given country, a single residential or mobile proxy already does it; [how to hide your IP address](https://quanticdata.io/blog/how-to-hide-ip-address/) shows that with real output. A chain also does not encrypt anything a single HTTPS connection does not already encrypt.

## Proxy chaining vs VPN

A VPN carries all of a device's traffic through one server, encrypted to that server. A proxy chain carries the traffic of the app you point at it, through several servers. You can combine them: a VPN on the device and a proxy in the app makes the VPN the first hop. The single-hop comparison is in [residential proxy vs VPN](https://quanticdata.io/blog/residential-proxy-vs-vpn/).

## Proxy chaining on Windows and Linux

- **Windows, command line:** curl with `--preproxy` and `-x`, as above. curl ships with Windows 11 as `curl.exe`. More options are in [how to use a proxy with curl](https://quanticdata.io/blog/how-to-use-a-proxy-with-curl/).
- **Linux:** ProxyChains forces any program's TCP connections through a list of proxies. It is a Linux tool.
- **Your own code:** open a tunnel to proxy 1, send a CONNECT to proxy 2 through it, then speak TLS to the site, in that order.

Every hop needs its address, port and login; [how to find your proxy server address](https://quanticdata.io/blog/how-to-find-proxy-server-address/) shows where those live on Windows.

## Which networks to put in a chain

The last hop decides what the site sees, so make it the network the site should see: Residential Basic or Premium for a home IP in a chosen country, Mobile for a carrier IP. curl's `--preproxy` needs a SOCKS5 line for the first hop; in our test that was a Mobile line on port 1080, and our page on SOCKS5 covers the other networks. The plans are on our pages for [residential proxies](https://quanticdata.io/residential-proxies/), [mobile proxies](https://quanticdata.io/mobile-proxies/) and [SOCKS5 proxies](https://quanticdata.io/socks5-proxies/); there is a [Residential Basic free trial](https://quanticdata.io/residential-proxy-free-trial/) to start.

### Sources & further reading

- [curl manual: --preproxy](https://curl.se/docs/manpage.html#--preproxy)
- [RFC 9110: HTTP Semantics, CONNECT](https://www.rfc-editor.org/rfc/rfc9110#name-connect)
- [RFC 1928: SOCKS Protocol Version 5](https://www.rfc-editor.org/rfc/rfc1928)

## FAQ

Quick answers on proxy chaining.

[Something else? Ask us](mailto:hello@quanticdata.io)

### What is proxy chaining?

Sending a request through two or more proxies in a row. The site sees only the last proxy's IP; each proxy connects only to the hop before and after it.

### How do I chain two proxies with curl?

Put the first hop in `--preproxy` (a SOCKS proxy) and the second in `-x`: `curl --preproxy socks5h://USER:PASS@HOST1:1080 -x http://USER:PASS@HOST2:8080 URL`. In our test, the site saw the second hop's exit in Germany.

### Does proxy chaining slow down requests?

Each hop adds its own time, so add a hop only when it does a job. For a home or mobile IP in a chosen country, one proxy is enough.

### Which IP does the website see in a proxy chain?

The exit IP of the last proxy. With a mobile proxy first and a residential proxy in Germany second, ipinfo.io reported a home line in Lower Saxony and nothing from the mobile hop.

### Is proxy chaining better than a VPN?

They do different jobs. A VPN covers the whole device through one server; a chain covers one app through several. For a home or mobile IP in a chosen country, one residential or mobile proxy is usually enough.

## The last hop decides what the site sees

Residential and mobile proxies in the country you pick, over HTTP or SOCKS5.

[Start free — $2/month included](https://quanticdata.io/signup/?utm_source=blog&utm_medium=website&utm_campaign=blog-end&utm_content=proxy-chaining) · [Explore Residential Proxies from $0.80/GB](https://quanticdata.io/residential-proxies/)

## Related reading

- [HTTP vs HTTPS: What a Proxy Sees in Each](https://quanticdata.io/blog/http-vs-https-proxy/): Proxies · HTTP sends requests as plain text; HTTPS wraps the same requests in TLS. We put a logging relay in front of a residential proxy line on 20 November 2026 and captured both: 340 readable bytes for http://, and for https:// one CONNECT line followed by 803 encrypted bytes.
- [Change Proxy IP by Link: Rotation Links](https://quanticdata.io/blog/change-proxy-ip-by-link/): Proxies · A rotation link is a URL that restarts one sticky session: open it and the session starts again; in our test of 20 November 2026 each of three calls was followed by a new exit IP. Below: the API call that creates the link, what it answered, the 10-second pause between rotations, and what to do on Mobile and Residential Premium.
- [ISP Proxy API: Stock, Quote and Buy by Code](https://quanticdata.io/blog/isp-proxy-api/): Proxies · The Premium ISP endpoints let a script do what the configurator does: read the catalog with live stock, pick a pool or a city and carrier, get a server-side quote and buy from the balance. Below: each call with the answer we got on 20 November 2026, what "currently unavailable" means, and how to write a buyer that never pays twice.

---

Source: https://quanticdata.io/blog/proxy-chaining/ · Site index for AI: https://quanticdata.io/llms.txt
