Proxy Technology

How Proxy Servers Work: Requests, Tunnels, DNS and Authentication Step by Step

Follow a single request from your application to a website and back through a proxy, including CONNECT tunnels for HTTPS, DNS resolution, authentication and the headers a proxy may add.

ProxyGrove Editorial · · · 10 min read

Blue sequence diagram of a client, proxy server and website exchanging request and response messages

TL;DR: A client sends its request to the proxy; the proxy authenticates the client, resolves the destination, connects outward from its own address and relays the response. For HTTPS, the client asks for a CONNECT tunnel and negotiates TLS end to end with the site. Headers, DNS location and authentication details determine what each party can see.

The big picture

Every proxy conversation has three parties: the client, the proxy and the destination. The client chooses to send its traffic to the proxy; the proxy makes a new connection to the destination; and the destination sees the proxy's address as the source. The proxy has two connections to manage, and what it can read on each depends on the protocol and on encryption.

This article follows the flow in order and highlights where information is visible. For the high-level introduction see what is a proxy server.

Step by step: a plain HTTP request

  1. Configuration. The client is set to use a proxy at a host and port.
  2. Connection. The client opens a TCP connection to the proxy, not to the website.
  3. Request. The client sends the full request line, including the absolute URL of the target, to the proxy.
  4. Authentication. If the proxy requires credentials it replies with 407 and a Proxy-Authenticate challenge; the client retries with Proxy-Authorization.
  5. Forwarding. The proxy resolves the target name, connects to it and sends the request.
  6. Response. The destination replies to the proxy, which relays the response to the client.

HTTP semantics, including proxy authentication, are defined in RFC 9110, and the MDN page on proxy servers and tunneling provides a readable summary.

Step by step: HTTPS through a CONNECT tunnel

For HTTPS the client does not send the web request to the proxy. Instead it sends a CONNECT example.com:443 request. If the proxy allows it, it opens a TCP connection to that host and port and replies with a success status. From then on, the proxy acts as a pipe. The client starts a TLS handshake with the website itself, so the proxy relays encrypted bytes and cannot read the page content. It still knows the destination host name and port, the timing and the volume of data. The CONNECT method page documents the details.

CONNECT example.com:443 HTTP/1.1
Host: example.com:443
Proxy-Authorization: Basic BASE64_OF_YOUR_PROXY_CREDENTIALS

Who can see what

PartyPlain HTTP targetHTTPS target
Local network observerSees proxy address, may see the request if the proxy link is not encryptedSees proxy address and encrypted traffic
Proxy operatorSees full request and responseSees host, port, timing and volume
Destination websiteSees proxy address and request headersSees proxy address and request headers

This table explains why encrypted destinations matter even when you use a proxy, and why the proxy operator's trustworthiness is a real consideration. See also residential proxy security.

Where DNS happens

Before connecting, someone has to translate a hostname into an IP address. With an HTTP proxy, the proxy normally resolves the name, so your local network does not perform the lookup. With SOCKS5, it depends on the client: socks5h style configuration sends the name to the proxy, whereas plain SOCKS5 resolution happens locally. The MDN DNS glossary explains the basics. Where DNS resolves can influence both privacy and which regional server a content delivery network chooses for you.

Headers a proxy may add or remove

Transparent or caching proxies may add headers such as Via, Forwarded or X-Forwarded-For to tell the destination about the original client. The MDN reference for X-Forwarded-For describes the common pattern. A proxy intended for privacy-oriented or business use cases generally does not forward your original address, but you should not assume this; test by requesting a header-echo page you control and inspect what arrives.

Forward, reverse and transparent proxies

  • Forward proxy: configured by the client to reach external sites, the type discussed throughout this blog.
  • Reverse proxy: sits in front of a website and distributes incoming requests; clients usually do not know it exists.
  • Transparent proxy: intercepts traffic on the network without client configuration, often in corporate or ISP environments.

The proxy products in ProxyGrove's catalog are forward proxies that you configure explicitly: Static IP, Residential, Mobile and Corporate.

Observe it yourself

  1. Run curl -v -x http://YOUR_PROXY_HOST:YOUR_PROXY_PORT https://example.com/ and read the CONNECT exchange in the verbose output.
  2. Add credentials with --proxy-user YOUR_PROXY_USERNAME:YOUR_PROXY_PASSWORD and watch the 407 handshake disappear.
  3. Compare the address reported by an IP-echo page with and without the proxy.
  4. Request a header-echo page you control and note which headers were added.

Performance: where the time goes

Using a proxy adds hops, and each hop adds latency. A request through a proxy includes the time to connect to the proxy, to authenticate, for the proxy to resolve and connect to the destination and for data to travel back. For HTTPS there is also a TLS handshake, which happens end to end through the tunnel. Warm connections are much faster than cold ones because they skip several of these steps, which is why keep-alive and client reuse matter for throughput.

Geography matters as well. If your client is in one continent, the proxy exit in another and the destination in a third, the path can be long. Choosing an exit near the destination often reduces latency, while choosing one near the intended audience reproduces what real users experience. Measure both when speed matters.

Common misunderstandings

  • Thinking the proxy can read HTTPS pages by default; it cannot without TLS interception, which clients must explicitly trust.
  • Assuming the proxy hides the destination from the proxy operator.
  • Believing the proxy encrypts your traffic to the proxy itself; that depends on the protocol.
  • Forgetting that cookies and logins identify you regardless of IP.

Frequently asked questions

Can a proxy see my HTTPS traffic?

A normal CONNECT proxy sees the destination host and port but not the encrypted content. Only deliberate TLS interception, which requires installing a trusted certificate, would allow reading it.

What is the CONNECT method used for?

It asks the proxy to open a raw TCP tunnel to a host and port, which is how HTTPS is carried through an HTTP proxy.

Where does DNS resolution happen with a proxy?

With HTTP proxies, usually on the proxy. With SOCKS5 it depends on whether the client sends the hostname or resolves locally.

Does a proxy add headers to my requests?

Some do, such as Via or X-Forwarded-For. Verify with a header-echo test for the specific proxy you use.

Why does the proxy need authentication?

To control who may use it and to account for usage. Authentication can be username and password or an allowlisted source IP.

Conclusion

Once you understand the sequence, connect, authenticate, tunnel or forward, resolve, relay, most proxy puzzles become answerable. You know where errors arise, what each party can see and which settings matter. Keep experimenting with curl, and when you need help applying it to your setup, reach out to ProxyGrove or review How It Works.

References

About the author

ProxyGrove Editorial

ProxyGrove Editorial publishes practical guides on proxy technology, automation, and responsible network workflows for international teams.

Sẵn sàng tìm giải pháp proxy phù hợp?

Explore ProxyGrove plans, then apply credentials in your tools with our Integrations guides.