โ† Back to Blog

How Proxies Work: A Simple Explanation for Beginners

Updated: January 2025 | Reading time: 17 minutes | Level: Advanced

๐Ÿ“…November 13, 2025

๐Ÿ”„ What is a Proxy Server

A Proxy Server acts as an intermediary server between a client (your device) and a destination server. When you use a proxy, your requests do not go directly to the website; instead, they first pass through the proxy server, which then forwards them to the intended destination.

Core Concept of Operation

WITHOUT PROXY (Direct Connection):
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”                                    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚  Client  โ”‚ โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ Direct Request โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ†’โ”‚  Server  โ”‚
โ”‚  (You)   โ”‚ โ†โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ Direct Response โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”‚ (Website)โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜                                    โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
   IP: 192.168.1.10                                IP: 93.184.216.34

WITH PROXY (Via Intermediary):
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”           โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”           โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚  Client  โ”‚ โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ†’โ”‚  Proxy   โ”‚ โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ†’โ”‚  Server  โ”‚
โ”‚  (You)   โ”‚           โ”‚  Server  โ”‚           โ”‚ (Website)โ”‚
โ”‚          โ”‚ โ†โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”‚          โ”‚ โ†โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”‚          โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜           โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜           โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
   IP: 192.168.1.10      IP: 203.0.113.45       IP: 93.184.216.34

The server sees the proxy's IP (203.0.113.45), not yours!

Why is a Proxy Server Needed?

๐Ÿ”’ Security and Anonymity

Hides your real IP address from destination servers, enhancing your anonymity online.

๐ŸŒ Bypassing Geo-restrictions

Allows access to content restricted by geographical boundaries.

โšก Performance

Caching frequently requested content reduces load and speeds up page loading.

๐Ÿ›ก๏ธ Traffic Filtering

Corporate proxies block unwanted content and protect against threats.

โš–๏ธ Load Balancing

Distributes incoming requests across multiple servers to enhance reliability.

๐Ÿ” Monitoring and Logging

Tracks all requests for analytics, security, or policy compliance.

๐Ÿ’ก Key Difference from VPN

A proxy operates at the application level (e.g., only the browser), whereas a VPN encrypts all device traffic at the network level. Proxies are faster and more flexible, while VPNs offer more comprehensive traffic security.

๐ŸŽญ The Role of a Proxy as an Intermediary

The proxy server acts as a smart intermediary between the client and the server. It doesn't just forward data; it actively processes requests and responses, making decisions on how to handle them.

Proxy Functions as an Intermediary

1. Request Modification

The proxy can alter HTTP headers before sending the request to the destination server:

  • User-Agent: Changes browser information (can pretend to be Chrome instead of Firefox)
  • X-Forwarded-For: Adds information about the client's real IP
  • Accept-Language: Modifies the preferred content language
  • Referer: Hides or substitutes the referring source

2. Access Policy Checking

The proxy checks whether access to the requested resource is permitted based on:

  • Client IP address (whitelists/blacklists)
  • Authentication (login/password, tokens)
  • Time of day (social media access only after work hours)
  • Content category (blocking games, adult content, torrents)

3. Content Caching

The proxy saves copies of frequently requested resources (images, CSS, JavaScript) and serves them from the cache, avoiding the need to contact the server. This saves traffic and speeds up loading by 50-90%.

4. Response Modification

The proxy can alter content before sending it back to the client:

  • Content compression (gzip, brotli) to save traffic
  • Ad and tracker blocking
  • Adding/removing security headers
  • Script injection (e.g., for corporate analytics)

5. Logging and Analytics

The proxy records information about every request: who accessed what, when, and how much data was transferred. This is used for:

  • Traffic usage monitoring
  • Anomaly and attack detection
  • Corporate policy compliance
  • Debugging and diagnostics

โš™๏ธ Three Proxy Operating Modes

๐Ÿ”ต Passthrough Mode

The proxy simply forwards data without modification. Minimal processing, maximum speed.

๐ŸŸข Intercepting Mode

The proxy actively analyzes and modifies requests/responses. Used for filtering, optimization, and security.

๐ŸŸก Hybrid Mode

The proxy decides for each request whether to pass it through as is or process it. For example, caching only static assets while proxying API calls directly.

๐Ÿ”„ Request-Response Flow via Proxy

Let's examine in detail what happens at each stage when you request a web page through a proxy server.

Step-by-Step Proxy Operation

Step 1: Client Sends Request to Proxy

GET http://example.com/page.html HTTP/1.1
Host: example.com
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64)
Proxy-Authorization: Basic dXNlcjpwYXNz
Connection: keep-alive

โ†“ Request goes to the proxy server (not directly to example.com)

The client is configured to use the proxy, so the connection is established with the proxy server even for a request to example.com.

Step 2: Proxy Receives and Validates Request

The proxy performs a series of checks:

  • โœ… Authentication: Checks login/password in the Proxy-Authorization header
  • โœ… Authorization: Is this user allowed to access example.com?
  • โœ… Filtering: Is the domain example.com blocked by policy?
  • โœ… Cache: Is there a current copy of /page.html in the cache?

Step 3A: If Cached โ€” Return Immediately

โœ… CACHE HIT โ€” Found in cache!

HTTP/1.1 200 OK
Content-Type: text/html
Age: 120
X-Cache: HIT from proxy-server

<html>...page content...</html>

โ†‘ Proxy returns content from cache (very fast!)

The Age: 120 header means the content has been in the cache for 120 seconds.

Step 3B: If Not Cached โ€” Request from Server

โŒ CACHE MISS โ€” Not in cache, request to server

Proxy modifies headers:

GET /page.html HTTP/1.1
Host: example.com
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64)
X-Forwarded-For: 192.168.1.10     โ† Adds your real IP
Via: 1.1 proxy-server             โ† Indicates request is via proxy
Connection: keep-alive

โ†“ Proxy sends request to example.com from its own IP

Step 4: Destination Server Processes Request

The example.com server receives the request from the proxy and sees:

  • ๐ŸŒ Source IP: 203.0.113.45 (Proxy IP, not your 192.168.1.10)
  • ๐Ÿ“‹ X-Forwarded-For: 192.168.1.10 (optional, if proxy is transparent)
  • ๐Ÿ”— Via: 1.1 proxy-server (information about the proxy)
HTTP/1.1 200 OK
Content-Type: text/html
Content-Length: 12345
Cache-Control: max-age=3600
Last-Modified: Wed, 13 Jan 2025 10:00:00 GMT

<html>...page content...</html>

Step 5: Proxy Processes Response

The proxy receives the response and performs actions:

  • ๐Ÿ’พ Caching: Saves content to cache for 3600 seconds (1 hour), based on Cache-Control
  • ๐Ÿ—œ๏ธ Compression: May compress content (gzip/brotli) to save traffic
  • ๐Ÿ” Filtering: Checks content for viruses, blocks ads
  • ๐Ÿ“Š Logging: Records in the log: who requested what, response size

Step 6: Proxy Returns Response to Client

HTTP/1.1 200 OK
Content-Type: text/html
Content-Length: 12345
X-Cache: MISS from proxy-server        โ† Request was made to server
X-Cache-Lookup: MISS from proxy-server
Via: 1.1 proxy-server

<html>...page content...</html>

โ†‘ Client receives content

โšก Performance: With Cache vs Without Cache

Stage Without Cache With Cache
DNS Lookup 50ms 0ms
TCP Connection 100ms 0ms
TLS Handshake 200ms 0ms
Request Processing 150ms 0ms
Data Transfer 300ms 50ms
TOTAL 800ms 50ms (16x Faster!)

๐Ÿ—๏ธ Proxy Server Architecture

A modern proxy server is a complex system with several components working together to ensure performance, security, and reliability.

Core Architectural Components

1๏ธโƒฃ Connection Manager

Functions:

  • Accepts incoming TCP connections from clients
  • Manages connection pooling to destination servers
  • Reuses connections (HTTP Keep-Alive) to save resources
  • Handles timeouts and connection drops

Technologies: Event-driven architecture (epoll, kqueue), asynchronous I/O

2๏ธโƒฃ Request Parser

Functions:

  • Parses HTTP requests (method, URL, headers, body)
  • Validates request correctness
  • Extracts authentication parameters
  • Determines the request type (GET, POST, CONNECT, etc.)

3๏ธโƒฃ Authentication & Authorization

Authentication Methods:

  • Basic Auth: Username:password in base64 (insecure without HTTPS)
  • IP Whitelist: Access only from specified IP addresses
  • Token Auth: Access tokens (JWT, OAuth)
  • Certificate Auth: Client SSL certificates

4๏ธโƒฃ Cache Engine

Functions:

  • Stores copies of resources in memory/on disk
  • Checks cache validity (Cache-Control, ETag, Last-Modified)
  • Uses eviction algorithms (LRU, LFU) when space is low
  • Supports conditional requests (If-Modified-Since, If-None-Match)

Storage: Memcached, Redis, Varnish, custom implementations

5๏ธโƒฃ Upstream Handler

Functions:

  • Selects the destination server from a list (load balancing)
  • Establishes connection to the upstream server
  • Forwards the request with modified headers
  • Handles errors and retry logic

6๏ธโƒฃ Response Processor

Functions:

  • Modifies response headers
  • Compresses content (gzip, brotli)
  • Filters/blocks unwanted content
  • Adds caching and security headers

7๏ธโƒฃ Logging & Monitoring

What is logged:

  • Timestamp, client IP, requested URL
  • Response code, size of transferred data
  • Request processing time
  • Cache hit/miss statistics
  • Errors and anomalies

โ†”๏ธ Forward vs Reverse Proxy

There are two main types of proxies that perform opposite roles: a Forward Proxy protects clients, while a Reverse Proxy protects servers.

โžก๏ธ Forward Proxy

Clients โ†’ Forward Proxy โ†’ Internet

Client1 โ”
Client2 โ”œโ”€โ†’ Forward โ†’ Server1
Client3 โ”˜    Proxy     Server2
                        Server3

Characteristics:

  • Who uses: Clients (users)
  • Goal: Hide clients from servers
  • Location: Client-side
  • Who knows about the proxy: Clients

Use Cases:

  • โœ… Bypassing blocks and censorship
  • โœ… Online anonymity
  • โœ… Corporate content filtering
  • โœ… IP rotation for scraping
  • โœ… Bypassing geo-restrictions

Popular Solutions:

Squid, ProxyCove, Residential Proxies, SOCKS5 proxies

โฌ…๏ธ Reverse Proxy

Internet โ†’ Reverse Proxy โ†’ Servers

Client1     Reverse  โ”Œโ”€โ†’ Backend1
Client2  โ”€โ”€โ†’ Proxy  โ”€โ”ผโ”€โ†’ Backend2
Client3              โ””โ”€โ†’ Backend3

Characteristics:

  • Who uses: Server owners
  • Goal: Protect and optimize servers
  • Location: Server-side
  • Who knows about the proxy: Administrators

Use Cases:

  • โœ… Load balancing
  • โœ… SSL/TLS termination
  • โœ… Static content caching
  • โœ… DDoS protection
  • โœ… Hiding real servers

Popular Solutions:

Nginx, HAProxy, Cloudflare, AWS ELB, Varnish

๐Ÿ” Comparison Table

Parameter Forward Proxy Reverse Proxy
Protects Clients Servers
Visibility Clients know about the proxy Clients do not know
IP seen by server Proxy IP Client IP (via X-Forwarded-For)
Configuration On the client On the server
Caching To speed up clients To offload servers
Typical Use Anonymity, bypassing blocks Load balancing, security

๐Ÿ‘๏ธ Transparent vs Explicit Proxy

Proxies are also classified by whether the client is aware of the proxy's existence: Transparent and Explicit.

๐Ÿ‘ป Transparent Proxy

How it works:

The proxy intercepts traffic at the network level (via a router or firewall) without client configuration. The client believes it is connecting directly to the server, but the traffic passes through the proxy.

Client thinks:
GET example.com โ†’ Directly

In reality:
GET example.com โ†’ [Transparent Proxy] โ†’ example.com

Client is unaware of the proxy!

Characteristics:

  • โœ… Requires no client configuration
  • โœ… Works for all applications automatically
  • โš ๏ธ Uses standard GET/POST methods
  • โš ๏ธ Client does not send Proxy-Authorization
  • โŒ Harder to handle HTTPS (requires MITM)

Application:

  • Corporate networks (filtering without setup)
  • ISP proxies (content caching by provider)
  • Public Wi-Fi content filtering
  • Parental control

๐Ÿ“ข Explicit Proxy

How it works:

The client is explicitly configured to use the proxy. All requests are sent to the proxy server, which then forwards them to the destination servers.

Browser configured for proxy:
Proxy: proxy.example.com:8080

HTTP Request:
GET http://example.com/ HTTP/1.1
Host: example.com
Proxy-Authorization: Basic xyz123

HTTPS Request:
CONNECT example.com:443 HTTP/1.1
Host: example.com:443
Proxy-Authorization: Basic xyz123

Characteristics:

  • โœ… Client knows about the proxy
  • โœ… Supports authentication
  • โœ… Uses CONNECT for HTTPS
  • โœ… Full control at the application level
  • โš ๏ธ Requires configuration for each application

Application:

  • Personal anonymity (ProxyCove)
  • Web scraping and parsing
  • Testing from different IPs
  • Multi-accounting

๐Ÿ”‘ Key Difference: CONNECT Method

Transparent proxies do not receive CONNECT requests for HTTPS because the browser thinks it's connecting directly. It uses standard GET/POST.

Explicit proxies receive CONNECT requests for HTTPS, allowing a tunnel to be established without decrypting traffic (end-to-end encryption is preserved).

๐Ÿ”Œ Proxy Protocols

Proxy servers use various protocols to communicate with clients. Each protocol has its specific features, advantages, and limitations.

Main Protocols

1. HTTP Proxy

  • OSI Layer: Application (Layer 7)
  • Proxies: Only HTTP/HTTPS traffic
  • Protocols: HTTP/1.1, HTTP/2, HTTP/3
  • Features: Understands HTTP headers, can modify requests
  • Usage: Browsers, API clients, web scrapers

2. HTTPS Proxy (HTTP CONNECT)

  • OSI Layer: Application (Layer 7)
  • Proxies: HTTPS via tunneling
  • Method: HTTP CONNECT for tunnel creation
  • Features: Does not see HTTPS content (end-to-end encryption)
  • Usage: Securely proxying HTTPS sites

3. SOCKS4 Proxy

  • OSI Layer: Session (Layer 5)
  • Proxies: Only TCP connections
  • Features: Simple protocol, no UDP or authentication support
  • Usage: Legacy, rarely used in 2025

4. SOCKS5 Proxy

  • OSI Layer: Session (Layer 5)
  • Proxies: TCP and UDP traffic (any protocol)
  • Features: Supports authentication, UDP, IPv6
  • Usage: Torrents, gaming, VoIP, universal proxying

๐Ÿ“Š Protocol Comparison

Characteristic HTTP HTTPS SOCKS4 SOCKS5
HTTP Traffic โœ… โœ… โœ… โœ…
HTTPS Traffic โŒ โœ… โœ… โœ…
FTP, SMTP, POP3 โŒ โŒ โœ… โœ…
UDP Traffic โŒ โŒ โŒ โœ…
Authentication โœ… โœ… โŒ โœ…
Speed High High Very High Very High
Caching โœ… โœ… โŒ โŒ

๐ŸŒ HTTP Proxy in Detail

An HTTP proxy operates at the application layer and understands the structure of the HTTP protocol, allowing it to analyze and modify requests.

Request via HTTP Proxy

Standard HTTP Request (No Proxy)

GET /api/users HTTP/1.1
Host: api.example.com
User-Agent: Mozilla/5.0
Accept: application/json
Connection: keep-alive

โ†’ Sent directly to api.example.com

HTTP Request via Proxy

GET http://api.example.com/api/users HTTP/1.1
Host: api.example.com
User-Agent: Mozilla/5.0
Accept: application/json
Proxy-Authorization: Basic dXNlcjpwYXNzd29yZA==
Proxy-Connection: keep-alive

โ†’ Sent to the proxy server (not api.example.com!)

Differences:

  • The URL in the first line is absolute (with protocol and domain)
  • Proxy-Authorization header is added
  • Proxy-Connection is used instead of Connection

What the Proxy Does with the Request

1. Proxy receives request from client
2. Checks Proxy-Authorization (user:pass)
3. Extracts target URL: http://api.example.com/api/users
4. Modifies request for server forwarding:

GET /api/users HTTP/1.1
Host: api.example.com
User-Agent: Mozilla/5.0
Accept: application/json
X-Forwarded-For: 192.168.1.100        โ† Adds client IP
Via: 1.1 proxy-server.com              โ† Proxy information
X-Real-IP: 192.168.1.100               โ† Client's real IP
Connection: keep-alive

5. Sends modified request to api.example.com
6. Receives response from api.example.com
7. Forwards response to client

๐Ÿ” Authentication in HTTP Proxy

Basic Authentication

Login and password are base64 encoded and sent in the header:

Proxy-Authorization: Basic dXNlcjpwYXNzd29yZA==

Decodes to: user:password

โš ๏ธ IMPORTANT: Base64 is NOT encryption!
Use only with HTTPS proxies!

Digest Authentication

A more secure method using hashing:

1. Client โ†’ Proxy: GET http://example.com/ HTTP/1.1
2. Proxy โ†’ Client: 407 Proxy Authentication Required
   Proxy-Authenticate: Digest realm="proxy", nonce="abc123"
3. Client calculates hash:
   hash = MD5(username:realm:password)
   response = MD5(hash:nonce:MD5(method:uri))
4. Client โ†’ Proxy:
   Proxy-Authorization: Digest username="user",
                                 response="xyz789",
                                 nonce="abc123"

๐Ÿ”’ HTTP CONNECT Method

CONNECT is a special HTTP method that turns the proxy into a TCP tunnel. This allows proxying HTTPS without decrypting the traffic.

How CONNECT Works

Step 1: Client Requests a Tunnel

CONNECT example.com:443 HTTP/1.1
Host: example.com:443
Proxy-Authorization: Basic dXNlcjpwYXNzd29yZA==
User-Agent: Mozilla/5.0

โ†’ Client asks the proxy to establish a TCP connection to example.com:443

Important: CONNECT is used for port 443 (HTTPS), not 80 (HTTP).

Step 2: Proxy Establishes Connection

Proxy performs actions:
1. Checks Proxy-Authorization
2. Establishes TCP connection to example.com:443
3. Responds to the client:

HTTP/1.1 200 Connection established

โ†’ Tunnel established! The proxy now just forwards bytes.

Step 3: Client Begins TLS Handshake

Client โ†’ Proxy โ†’ Server: ClientHello (start of TLS)
   [Version: TLS 1.3]
   [Cipher Suites: TLS_AES_128_GCM_SHA256, ...]
   [SNI: example.com]  โ† DPI might see this!
   [Supported Groups: x25519, secp256r1]

Server โ†’ Proxy โ†’ Client: ServerHello
   [Selected Cipher: TLS_AES_128_GCM_SHA256]
   [Server Certificate for example.com]
   [Key Share]

Client โ†’ Proxy โ†’ Server: ClientKeyExchange
   [Client Key Exchange - encrypted]
   [Change Cipher Spec]

Step 7: SERVER โ†’ PROXY โ†’ CLIENT: TLS Finished
   [Server Finished - encrypted]

9. ENCRYPTED SESSION ESTABLISHED
   CLIENT โ‡„ PROXY โ‡„ SERVER: [all subsequent data is encrypted]

   GET /api/secret HTTP/1.1
   Host: example.com
   Authorization: Bearer secret_token_12345

   โ†‘ Proxy does NOT see this request! Only encrypted bytes.

Step 4: Exchanging Encrypted Data

Client โ†’ Proxy โ†’ Server: [encrypted data]
Server โ†’ Proxy โ†’ Client: [encrypted data]

Proxy sees only:
- Volume of transferred data
- Transfer time
- Destination IP

Proxy does NOT see:
- Request URL
- HTTP headers
- Page content
- Cookies and passwords

๐Ÿ“Š HTTP vs CONNECT โ€” What the Proxy Sees

Information HTTP (port 80) CONNECT (port 443)
Domain โœ… Visible โœ… Visible
URL Path โœ… Visible fully โŒ Not visible
HTTP Headers โœ… Visible all โŒ Not visible
Page Content โœ… Visible all HTML โŒ Encrypted
Passwords and Cookies โœ… Visible (DANGEROUS!) โŒ Encrypted
Traffic Volume โœ… Visible โœ… Visible

โš ๏ธ Security Note!

NEVER use a standard HTTP proxy to enter passwords!
The proxy sees everything in plain text. Always use HTTPS sites via CONNECT method or trusted proxy providers.

๐Ÿงฆ SOCKS Protocol

SOCKS (Socket Secure) is a protocol that operates at a lower level than HTTP and can proxy any TCP/UDP traffic.

SOCKS5 Handshake

Stage 1: Authentication Method Selection

Client โ†’ Server:
โ”Œโ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚0x05 โ”‚0x02 โ”‚0x00 0x02         โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
  VER  NMETHODS  METHODS

0x05 = SOCKS version 5
0x02 = 2 authentication methods proposed
0x00 = No authentication
0x02 = Username/Password

Server โ†’ Client:
โ”Œโ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚0x05 โ”‚0x02    โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
  VER   METHOD

0x02 = Username/Password method selected

Stage 2: Authentication (if required)

Client โ†’ Server:
โ”Œโ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚0x01 โ”‚ ULEN โ”‚ USERNAME โ”‚ PLEN โ”‚ PASSWORD โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

0x01 = Subnegotiation Version
ULEN = Username length
USERNAME = Login
PLEN = Password length
PASSWORD = Password

Server โ†’ Client:
โ”Œโ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚0x01 โ”‚0x00    โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
  VER   STATUS

0x00 = Authentication successful

Stage 3: Connection Request

Client โ†’ Server:
โ”Œโ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚0x05 โ”‚CMD  โ”‚0x00 โ”‚ATYP  โ”‚DST.ADDR  โ”‚PORT  โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”˜

0x05 = SOCKS5
CMD:
  0x01 = CONNECT (TCP connection)
  0x02 = BIND (wait for incoming connection)
  0x03 = UDP ASSOCIATE (UDP relay)
0x00 = Reserved
ATYP:
  0x01 = IPv4 address (4 bytes)
  0x03 = Domain name (variable)
  0x04 = IPv6 address (16 bytes)

Example for example.com:443
0x05 0x01 0x00 0x03 0x0B example.com 0x01BB

Server โ†’ Client:
โ”Œโ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚0x05 โ”‚0x00 โ”‚0x00 โ”‚0x01  โ”‚0.0.0.0   โ”‚0x0000โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”˜

0x00 = Connection successfully established

Stage 4: Data Transfer

After connection establishment, the SOCKS proxy acts as a TCP tunnel:

Client โ†’ SOCKS โ†’ Server: [application data]
Server โ†’ SOCKS โ†’ Client: [application data]

SOCKS simply forwards bytes without analyzing content!

SOCKS5 Advantages

  • โœ… Versatility: Works with any protocol (HTTP, FTP, SMTP, BitTorrent, games)
  • โœ… UDP Support: The only proxy protocol with full UDP support
  • โœ… Performance: Low overhead, very fast
  • โœ… Security: Does not analyze content, fully transparent to applications
  • โœ… IPv6: Native support for IPv6 addresses

๐Ÿ” SSL/TLS Handshake via Proxy

Understanding how TLS works through a proxy is critical for security. In 2025, TLS 1.3 is the standard.

Full HTTPS Process via Proxy

1. CLIENT โ†’ PROXY: TCP Handshake
   SYN โ†’ SYN-ACK โ†’ ACK (connection to proxy established)

2. CLIENT โ†’ PROXY: HTTP CONNECT
   CONNECT example.com:443 HTTP/1.1
   Host: example.com:443
   Proxy-Authorization: Basic dXNlcjpwYXNzd29yZA==
   User-Agent: Mozilla/5.0

3. PROXY โ†’ SERVER: TCP Handshake
   (proxy establishes connection to example.com:443)

4. PROXY โ†’ CLIENT: 200 Connection established

5. CLIENT โ†’ PROXY โ†’ SERVER: TLS ClientHello
   [Version: TLS 1.3]
   [Cipher Suites: TLS_AES_128_GCM_SHA256, ...]
   [SNI: example.com]  โ† DPI can see this!
   [Supported Groups: x25519, secp256r1]

6. SERVER โ†’ PROXY โ†’ CLIENT: TLS ServerHello
   [Selected Cipher: TLS_AES_128_GCM_SHA256]
   [Server Certificate for example.com]
   [Key Share]

7. CLIENT โ†’ PROXY โ†’ SERVER: TLS Finished
   [Client Key Exchange - encrypted]
   [Change Cipher Spec]

8. SERVER โ†’ PROXY โ†’ CLIENT: TLS Finished
   [Server Finished - encrypted]

9. ENCRYPTED SESSION ESTABLISHED
   CLIENT โ‡„ PROXY โ‡„ SERVER: [all subsequent data is encrypted]

   GET /api/secret HTTP/1.1
   Host: example.com
   Authorization: Bearer secret_token_12345

   โ†‘ Proxy does NOT see this request! Only encrypted bytes.

โš ๏ธ What DPI Systems Can See

Even through a CONNECT tunnel, DPI (Deep Packet Inspection) systems can extract some information:

  • ๐Ÿ“Œ SNI (Server Name Indication): The domain name in ClientHello (sent in cleartext in TLS 1.2 and below)
  • ๐Ÿ“Œ Destination IP Address: Where the connection is going
  • ๐Ÿ“Œ Traffic Volume: How much data is transferred
  • ๐Ÿ“Œ Timing patterns: Activity patterns can reveal content type

๐Ÿ›ก๏ธ Protection: ECH (Encrypted Client Hello)

In 2025, modern servers support ECH (Encrypted Client Hello)โ€”a TLS 1.3 standard that encrypts the SNI. This makes it impossible to determine the domain via DPI.

๐Ÿ”“ SSL Interception (MITM Proxy)

Some corporate proxies perform SSL Interceptionโ€”decrypting HTTPS traffic:

CLIENT โ†’ [TLS to Proxy] โ†’ PROXY โ†’ [TLS to Server] โ†’ SERVER

The Proxy performs two TLS handshakes:
1. With the client (using its own certificate)
2. With the server (on behalf of the client)

The Proxy sees ALL HTTPS content!

โš ๏ธ Requires installation of the proxy's root certificate on the client
โš ๏ธ The browser will show a warning if the certificate is not trusted

Application: Corporate networks for employee monitoring, antivirus software for checking HTTPS for viruses, DLP systems.

๐Ÿ“‹ Important HTTP Headers for Proxies

X-Forwarded-For

Contains the client's real IP address. Added by the proxy.

X-Forwarded-For: 192.168.1.100

X-Real-IP

An alternative to X-Forwarded-For, containing a single IP.

X-Real-IP: 192.168.1.100

Via

Shows the chain of proxies the request passed through.

Via: 1.1 proxy1, 1.1 proxy2

X-Forwarded-Proto

Indicates the protocol of the original request (http/https).

X-Forwarded-Proto: https

X-Forwarded-Host

The original Host header sent by the client.

X-Forwarded-Host: example.com

Proxy-Authorization

Credentials for authenticating with the proxy server.

Proxy-Authorization: Basic xyz123

๐Ÿ” How a Server Detects a Proxy

A server can determine that a request is coming through a proxy based on the following indicators:

  • Presence of X-Forwarded-* and Via headers
  • The IP address belongs to a known proxy database
  • Mismatch between IP geolocation and other parameters (language, timezone)
  • Anomalous activity patterns (too fast requests)

Professional Proxies for Any Task

Now you understand how proxies workโ€”it's time to put that knowledge into practice!
ProxyCoveโ€”modern infrastructure with proxies in 195+ countries.
Register with promo code ARTHELLO = +$1.3 bonus to start

๐Ÿ“– Continuation in Part 2: Technical details โ€” protocols (HTTP, SOCKS), headers, the CONNECT method, SSL/TLS handshake via proxy, and HTTPS operation.

How a Proxy Server Works โ€” Part 2

Technical details: HTTP and SOCKS protocols, headers, the CONNECT method, SSL/TLS handshake via proxy, and HTTPS specifics.

Updated: January 2025 | Read Time: 17 minutes | Level: Advanced

๐Ÿ”Œ Proxy Protocols

Proxy servers utilize various protocols for communication with clients. Each protocol has its specific features, advantages, and limitations.

Main Protocols

1. HTTP Proxy

  • OSI Layer: Application (Layer 7)
  • Proxies: Only HTTP/HTTPS traffic
  • Protocols: HTTP/1.1, HTTP/2, HTTP/3
  • Features: Understands HTTP headers, can modify requests
  • Usage: Browsers, API clients, web scrapers

2. HTTPS Proxy (HTTP CONNECT)

  • OSI Layer: Application (Layer 7)
  • Proxies: HTTPS via tunneling
  • Method: HTTP CONNECT for tunnel creation
  • Features: Does not see HTTPS content (end-to-end encryption)
  • Usage: Securely proxying HTTPS sites

3. SOCKS4 Proxy

  • OSI Layer: Session (Layer 5)
  • Proxies: Only TCP connections
  • Features: Simple protocol, no UDP or authentication support
  • Usage: Legacy, rarely used in 2025

4. SOCKS5 Proxy

  • OSI Layer: Session (Layer 5)
  • Proxies: TCP and UDP traffic (any protocol)
  • Features: Supports authentication, UDP, IPv6
  • Usage: Torrents, gaming, VoIP, universal proxying

๐Ÿ“Š Protocol Comparison

Characteristic HTTP HTTPS SOCKS4 SOCKS5
HTTP Traffic โœ… โœ… โœ… โœ…
HTTPS Traffic โŒ โœ… โœ… โœ…
FTP, SMTP, POP3 โŒ โŒ โœ… โœ…
UDP Traffic โŒ โŒ โŒ โœ…
Authentication โœ… โœ… โŒ โœ…
Speed High High Very High Very High
Caching โœ… โœ… โŒ โŒ

๐ŸŒ HTTP Proxy in Detail

An HTTP proxy operates at the application layer and understands the structure of the HTTP protocol, allowing it to analyze and modify requests.

Request via HTTP Proxy

Standard HTTP Request (No Proxy)

GET /api/users HTTP/1.1
Host: api.example.com
User-Agent: Mozilla/5.0
Accept: application/json
Connection: keep-alive

โ†’ Sent directly to api.example.com

HTTP Request via Proxy

GET http://api.example.com/api/users HTTP/1.1
Host: api.example.com
User-Agent: Mozilla/5.0
Accept: application/json
Proxy-Authorization: Basic dXNlcjpwYXNzd29yZA==
Proxy-Connection: keep-alive

โ†’ Sent to the proxy server (not api.example.com!)

Differences:

  • The URL in the first line is absolute (with protocol and domain)
  • Proxy-Authorization header is added
  • Proxy-Connection is used instead of Connection

What the Proxy Does with the Request

1. Proxy receives request from client
2. Checks Proxy-Authorization (user:pass)
3. Extracts target URL: http://api.example.com/api/users
4. Modifies request for server forwarding:

GET /api/users HTTP/1.1
Host: api.example.com
User-Agent: Mozilla/5.0
Accept: application/json
X-Forwarded-For: 192.168.1.100        โ† Adds client IP
Via: 1.1 proxy-server.com              โ† Proxy information
X-Real-IP: 192.168.1.100               โ† Client's real IP
Connection: keep-alive

5. Sends modified request to api.example.com
6. Receives response from api.example.com
7. Forwards response to client

๐Ÿ” Authentication in HTTP Proxy

Basic Authentication

Login and password are base64 encoded and sent in the header:

Proxy-Authorization: Basic dXNlcjpwYXNzd29yZA==

Decodes to: user:password

โš ๏ธ IMPORTANT: Base64 is NOT encryption!
Use only with HTTPS proxies!

Digest Authentication

A more secure method using hashing:

1. Client โ†’ Proxy: GET http://example.com/ HTTP/1.1
2. Proxy โ†’ Client: 407 Proxy Authentication Required
   Proxy-Authenticate: Digest realm="proxy", nonce="abc123"
3. Client calculates hash:
   hash = MD5(username:realm:password)
   response = MD5(hash:nonce:MD5(method:uri))
4. Client โ†’ Proxy:
   Proxy-Authorization: Digest username="user",
                                 response="xyz789",
                                 nonce="abc123"

๐Ÿ”’ HTTP CONNECT Method

CONNECT is a special HTTP method that turns the proxy into a TCP tunnel. This allows proxying HTTPS without decrypting the traffic.

How CONNECT Works

Step 1: Client Requests a Tunnel

CONNECT example.com:443 HTTP/1.1
Host: example.com:443
Proxy-Authorization: Basic dXNlcjpwYXNzd29yZA==
User-Agent: Mozilla/5.0

โ†’ Client asks the proxy to establish a TCP connection to example.com:443

Important: CONNECT is used for port 443 (HTTPS), not 80 (HTTP).

Step 2: Proxy Establishes Connection

Proxy performs actions:
1. Checks Proxy-Authorization
2. Establishes TCP connection to example.com:443
3. Responds to the client:

HTTP/1.1 200 Connection established

โ†’ Tunnel established! The proxy now just forwards bytes.

Step 3: Client Begins TLS Handshake

Client โ†’ Proxy โ†’ Server: ClientHello (start of TLS)
   [Version: TLS 1.3]
   [Cipher Suites: TLS_AES_128_GCM_SHA256, ...]
   [SNI: example.com]  โ† DPI might see this!
   [Supported Groups: x25519, secp256r1]

Server โ†’ Proxy โ†’ Client: ServerHello
   [Selected Cipher: TLS_AES_128_GCM_SHA256]
   [Server Certificate for example.com]
   [Key Share]

Client โ†’ Proxy โ†’ Server: ClientKeyExchange
   [Client Key Exchange - encrypted]
   [Change Cipher Spec]

Step 7: SERVER โ†’ PROXY โ†’ CLIENT: TLS Finished
   [Server Finished - encrypted]

9. ENCRYPTED SESSION ESTABLISHED
   CLIENT โ‡„ PROXY โ‡„ SERVER: [all subsequent data is encrypted]

   GET /api/secret HTTP/1.1
   Host: example.com
   Authorization: Bearer secret_token_12345

   โ†‘ Proxy does NOT see this request! Only encrypted bytes.

Step 4: Exchanging Encrypted Data

Client โ†’ Proxy โ†’ Server: [encrypted data]
Server โ†’ Proxy โ†’ Client: [encrypted data]

Proxy sees only:
- Volume of transferred data
- Transfer time
- Destination IP

Proxy does NOT see:
- Request URL
- HTTP headers
- Page content
- Cookies and passwords

๐Ÿ“Š HTTP vs CONNECT โ€” What the Proxy Sees

Information HTTP (port 80) CONNECT (port 443)
Domain โœ… Visible โœ… Visible
URL Path โœ… Visible fully โŒ Not visible
HTTP Headers โœ… Visible all โŒ Not visible
Page Content โœ… Visible all HTML โŒ Encrypted
Passwords and Cookies โœ… Visible (DANGEROUS!) โŒ Encrypted
Traffic Volume โœ… Visible โœ… Visible

โš ๏ธ Security Note!

NEVER use a standard HTTP proxy to enter passwords!
The proxy sees everything in plain text. Always use HTTPS sites via CONNECT method or trusted proxy providers.

๐Ÿงฆ SOCKS Protocol

SOCKS (Socket Secure) is a protocol that operates at a lower level than HTTP and can proxy any TCP/UDP traffic.

SOCKS5 Handshake

Stage 1: Authentication Method Selection

Client โ†’ Server:
โ”Œโ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚0x05 โ”‚0x02 โ”‚0x00 0x02         โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
  VER  NMETHODS  METHODS

0x05 = SOCKS version 5
0x02 = 2 authentication methods proposed
0x00 = No authentication
0x02 = Username/Password

Server โ†’ Client:
โ”Œโ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚0x05 โ”‚0x02    โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
  VER   METHOD

0x02 = Username/Password method selected

Stage 2: Authentication (if required)

Client โ†’ Server:
โ”Œโ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚0x01 โ”‚ ULEN โ”‚ USERNAME โ”‚ PLEN โ”‚ PASSWORD โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

0x01 = Subnegotiation Version
ULEN = Username length
USERNAME = Login
PLEN = Password length
PASSWORD = Password

Server โ†’ Client:
โ”Œโ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚0x01 โ”‚0x00    โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
  VER   STATUS

0x00 = Authentication successful

Stage 3: Connection Request

Client โ†’ Server:
โ”Œโ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚0x05 โ”‚CMD  โ”‚0x00 โ”‚ATYP  โ”‚DST.ADDR  โ”‚PORT  โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”˜

0x05 = SOCKS5
CMD:
  0x01 = CONNECT (TCP connection)
  0x02 = BIND (wait for incoming connection)
  0x03 = UDP ASSOCIATE (UDP relay)
0x00 = Reserved
ATYP:
  0x01 = IPv4 address (4 bytes)
  0x03 = Domain name (variable)
  0x04 = IPv6 address (16 bytes)

Example for example.com:443
0x05 0x01 0x00 0x03 0x0B example.com 0x01BB

Server โ†’ Client:
โ”Œโ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚0x05 โ”‚0x00 โ”‚0x00 โ”‚0x01  โ”‚0.0.0.0   โ”‚0x0000โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”˜

0x00 = Connection successfully established

Stage 4: Data Transfer

After connection establishment, the SOCKS proxy acts as a TCP tunnel:

Client โ†’ SOCKS โ†’ Server: [application data]
Server โ†’ SOCKS โ†’ Client: [application data]

SOCKS simply forwards bytes without analyzing content!

SOCKS5 Advantages

  • โœ… Versatility: Works with any protocol (HTTP, FTP, SMTP, BitTorrent, games)
  • โœ… UDP Support: The only proxy protocol with full UDP support
  • โœ… Performance: Low overhead, very fast
  • โœ… Security: Does not analyze content, fully transparent to applications
  • โœ… IPv6: Native support for IPv6 addresses

๐Ÿ” SSL/TLS Handshake via Proxy

Understanding how TLS works through a proxy is critical for security. In 2025, TLS 1.3 is the standard.

Full HTTPS Process via Proxy

1. CLIENT โ†’ PROXY: TCP Handshake
   SYN โ†’ SYN-ACK โ†’ ACK (connection to proxy established)

2. CLIENT โ†’ PROXY: HTTP CONNECT
   CONNECT example.com:443 HTTP/1.1
   Host: example.com:443
   Proxy-Authorization: Basic dXNlcjpwYXNzd29yZA==
   User-Agent: Mozilla/5.0

3. PROXY โ†’ SERVER: TCP Handshake
   (proxy establishes connection to example.com:443)

4. PROXY โ†’ CLIENT: 200 Connection established

5. CLIENT โ†’ PROXY โ†’ SERVER: TLS ClientHello
   [Version: TLS 1.3]
   [Cipher Suites: TLS_AES_128_GCM_SHA256, ...]
   [SNI: example.com]  โ† DPI can see this!
   [Supported Groups: x25519, secp256r1]

6. SERVER โ†’ PROXY โ†’ CLIENT: TLS ServerHello
   [Selected Cipher: TLS_AES_128_GCM_SHA256]
   [Server Certificate for example.com]
   [Key Share]

7. CLIENT โ†’ PROXY โ†’ SERVER: TLS Finished
   [Client Key Exchange - encrypted]
   [Change Cipher Spec]

8. SERVER โ†’ PROXY โ†’ CLIENT: TLS Finished
   [Server Finished - encrypted]

9. ENCRYPTED SESSION ESTABLISHED
   CLIENT โ‡„ PROXY โ‡„ SERVER: [all subsequent data is encrypted]

   GET /api/secret HTTP/1.1
   Host: example.com
   Authorization: Bearer secret_token_12345

   โ†‘ Proxy does NOT see this request! Only encrypted bytes.

โš ๏ธ What DPI Systems Can See

Even through a CONNECT tunnel, DPI (Deep Packet Inspection) systems can extract some information:

  • ๐Ÿ“Œ SNI (Server Name Indication): The domain name in ClientHello (sent in cleartext in TLS 1.2 and below)
  • ๐Ÿ“Œ Destination IP Address: Where the connection is going
  • ๐Ÿ“Œ Traffic Volume: How much data is transferred
  • ๐Ÿ“Œ Timing patterns: Activity patterns can reveal content type

๐Ÿ›ก๏ธ Protection: ECH (Encrypted Client Hello)

In 2025, modern servers support ECH (Encrypted Client Hello)โ€”a TLS 1.3 standard that encrypts the SNI. This makes it impossible to determine the domain via DPI.

๐Ÿ”“ SSL Interception (MITM Proxy)

Some corporate proxies perform SSL Interceptionโ€”decrypting HTTPS traffic:

CLIENT โ†’ [TLS to Proxy] โ†’ PROXY โ†’ [TLS to Server] โ†’ SERVER

The Proxy performs two TLS handshakes:
1. With the client (using its own certificate)
2. With the server (on behalf of the client)

The Proxy sees ALL HTTPS content!

โš ๏ธ Requires installation of the proxy's root certificate on the client
โš ๏ธ The browser will show a warning if the certificate is not trusted

Application: Corporate networks for employee monitoring, antivirus software for checking HTTPS for viruses, DLP systems.

๐Ÿ“‹ Important HTTP Headers for Proxies

X-Forwarded-For

Contains the client's real IP address. Added by the proxy.

X-Forwarded-For: 192.168.1.100

X-Real-IP

An alternative to X-Forwarded-For, containing a single IP.

X-Real-IP: 192.168.1.100

Via

Shows the chain of proxies the request passed through.

Via: 1.1 proxy1, 1.1 proxy2

X-Forwarded-Proto

Indicates the protocol of the original request (http/https).

X-Forwarded-Proto: https

X-Forwarded-Host

The original Host header sent by the client.

X-Forwarded-Host: example.com

Proxy-Authorization

Credentials for authenticating with the proxy server.

Proxy-Authorization: Basic xyz123

๐Ÿ” How a Server Detects a Proxy

A server can determine that a request is coming through a proxy based on the following indicators:

  • Presence of X-Forwarded-* and Via headers
  • The IP address belongs to a known proxy database
  • Mismatch between IP geolocation and other parameters (language, timezone)
  • Anomalous activity patterns (too fast requests)

๐Ÿ’พ Caching Mechanisms in Proxies

Caching is one of the key functions of proxy servers, allowing content loading to be accelerated by 50-90% and reducing load on backend servers.

How Caching Works

Caching Decision Algorithm

1. Request arrives at proxy
   GET /images/logo.png

2. Proxy calculates cache key:
   key = hash(method + URL + headers)
   key = "GET:example.com:/images/logo.png"

3. Cache check:
   if (cache exists AND cache is fresh):
       โœ… CACHE HIT
       - Check Cache-Control: max-age
       - Check Expires header
       - If fresh โ†’ return from cache
       - If stale โ†’ conditional request (If-Modified-Since)
   else:
       โŒ CACHE MISS
       - Request from origin server
       - Save to cache (if cacheable)
       - Return to client

4. Determine if caching is allowed:
   โœ… Yes, if:
      - HTTP method: GET or HEAD
      - Status: 200, 301, 304, 404
      - Cache-Control: public, max-age > 0
      - NO headers: Set-Cookie, Authorization
   โŒ No, if:
      - Cache-Control: no-store, private
      - Pragma: no-cache
      - POST, PUT, DELETE requests
      - Dynamic content with Set-Cookie

Caching Headers

Header Value Proxy Action
Cache-Control: max-age=3600 Cache for 1 hour โœ… Caches
Cache-Control: no-cache Always revalidate with server โš ๏ธ Conditional Request
Cache-Control: no-store Never cache โŒ Does not cache
Cache-Control: public Can be cached publicly โœ… Caches
Cache-Control: private Only for a single client โŒ Does not cache
ETag: "abc123" Version identifier โœ… For validation
Last-Modified: date Date of modification โœ… For validation

Conditional Requests

When the cache is stale, the proxy can check for freshness using conditional requests:

Scenario 1: Checking by ETag
โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
Proxy โ†’ Server:
GET /image.jpg HTTP/1.1
If-None-Match: "abc123"

If the file hasn't changed:
Server โ†’ Proxy:
HTTP/1.1 304 Not Modified
ETag: "abc123"

โ†’ Proxy serves from cache (saves traffic!)

If the file has changed:
Server โ†’ Proxy:
HTTP/1.1 200 OK
ETag: "xyz789"
[new content]

โ†’ Proxy updates cache


Scenario 2: Checking by Date
โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
Proxy โ†’ Server:
GET /style.css HTTP/1.1
If-Modified-Since: Wed, 13 Jan 2025 10:00:00 GMT

Server โ†’ Proxy:
HTTP/1.1 304 Not Modified

โ†’ Cache is fresh, serve from cache

Cache Eviction Algorithms

When the cache fills up, the proxy must decide what to remove:

1. LRU (Least Recently Used)

Removes objects that haven't been accessed for the longest time. The most popular algorithm.

image1.jpg (last accessed: 2 minutes ago)
style.css (last accessed: 10 minutes ago) โ† Removed first
logo.png (last accessed: 1 minute ago)

2. LFU (Least Frequently Used)

Removes objects that have been requested the fewest times.

logo.png (requests: 1000)
style.css (requests: 50) โ† Removed first
image1.jpg (requests: 500)

3. FIFO (First In First Out)

Removes the oldest objects in the cache. Simple, but not always efficient.

4. Size-aware algorithms

Consider the size of objects. For example, removing large, rarely used files to make room for many small, popular files.

๐Ÿ“Š Caching Efficiency

Typical Web Proxy Cache Statistics:

  • ๐Ÿ“ˆ Hit Rate: 60-80% for static content (images, CSS, JS)
  • ๐Ÿ“‰ Hit Rate: 5-20% for dynamic content (APIs, HTML)
  • โšก Speedup: Cache hit processed in 10-50ms vs 200-800ms for cache miss
  • ๐Ÿ’พ Traffic Savings: 40-70% reduction in outbound traffic to the origin
  • ๐Ÿ”‹ Load Reduction: 50-90% reduction in requests to backend servers

โš–๏ธ Load Balancing

Reverse proxies are often used to distribute load across multiple backend servers, ensuring high availability and scalability.

Load Balancing Algorithms

1๏ธโƒฃ Round Robin

Requests are distributed sequentially among the servers.

Request 1 โ†’ Server A
Request 2 โ†’ Server B
Request 3 โ†’ Server C
Request 4 โ†’ Server A (cycle repeats)

โœ… Pros: Simplicity, even distribution
โŒ Cons: Does not account for server load

2๏ธโƒฃ Least Connections

The new request is sent to the server with the fewest active connections.

Server A: 5 connections
Server B: 2 connections โ† New request goes here
Server C: 8 connections

โœ… Pros: Accounts for current load
โœ… Ideal for long-lived connections (WebSocket, streaming)

3๏ธโƒฃ IP Hash

The server is selected based on the hash of the client's IP address. One client always hits the same server.

hash(192.168.1.100) % 3 = 1 โ†’ Server B
hash(192.168.1.200) % 3 = 0 โ†’ Server A
hash(192.168.1.150) % 3 = 2 โ†’ Server C

โœ… Pros: Session persistence without sticky sessions
โŒ Cons: Uneven distribution with few clients

4๏ธโƒฃ Weighted Round Robin

Servers are assigned weights based on their capacity.

Server A (weight: 5) โ†’ receives 5 requests
Server B (weight: 2) โ†’ receives 2 requests
Server C (weight: 3) โ†’ receives 3 requests

Total 10 requests distributed in a 5:2:3 ratio

โœ… Ideal for heterogeneous servers (different capacities)

5๏ธโƒฃ Least Response Time

Selects the server with the minimum response time and fewest connections.

Server A: 50ms, 10 connections
Server B: 30ms, 5 connections โ† Selected
Server C: 100ms, 3 connections

โœ… Optimal performance for clients
โš ๏ธ Requires health check monitoring

๐Ÿฅ Health Checks

The Load Balancer constantly checks backend server availability:

Active Health Checks

The proxy actively sends probing requests:

Every 5 seconds:
GET /health HTTP/1.1
Host: backend-server

Response 200 OK โ†’ Server is healthy โœ…
Response 5xx or timeout โ†’ Server is down โŒ

Passive Health Checks

Analyzing real client requests:

If in the last 10 requests:
- 5 returned 5xx errors
- 3 resulted in timeouts
โ†’ Mark server as unhealthy for 30 seconds

๐Ÿ’ผ Practical Use Cases

๐Ÿ•ท๏ธ

Web Scraping

Task: Parse 100,000 pages without getting banned.

Solution:

  • Rotating residential proxies
  • New IP every 10 requests
  • SOCKS5 for versatility
  • Rate limiting: 2 req/sec per IP

Result: 0% blocks, 95% successful requests

๐ŸŽฏ

Ad Verification

Task: Verify ad display in 50 countries.

Solution:

  • Geo-targeting proxies (by country)
  • Residential IPs for realism
  • Screenshotting via headless browser
  • Rotating User-Agent headers

Result: Accurate ad placement verification

๐Ÿ’ฐ

Price Monitoring

Task: Monitor competitor prices 24/7.

Solution:

  • Datacenter proxies (cheaper)
  • Scheduled requests every 2 hours
  • Multiple proxy providers
  • Fallback to residential upon blocking

Result: Real-time price intelligence

๐ŸŽฎ

Sneaker Botting

Task: Purchase limited edition sneakers (drop).

Solution:

  • Residential proxies (anti-bot evasion)
  • ISP proxies for checkout (stability)
  • One IP = one account
  • Low latency (<50ms)

Result: Successful checkout before sold out

๐Ÿ“ฑ

Social Media Management

Task: Manage 100+ Instagram accounts.

Solution:

  • Mobile proxies (4G/5G IP)
  • Sticky sessions (10-30 minutes)
  • 1 account = 1 proxy (fingerprinting)
  • Geo-match: account and proxy from the same country

Result: 0 bans, natural engagement

๐ŸŒ

SEO Rank Tracking

Task: Track search rankings by region.

Solution:

  • Proxy geolocation (city/region)
  • Residential for accurate SERP results
  • Low request frequency (1-2/min)
  • SERP parsing with anti-captcha

Result: Accurate local rankings

๐ŸŽฏ Choosing the Right Proxy Type for Your Task

Task Proxy Type Protocol Cost
Web Scraping Residential HTTP/SOCKS5 $2.7/GB
Social Media (Instagram, TikTok) Mobile 4G/5G HTTP/SOCKS5 $3.8/GB
Price Monitoring (simple sites) Datacenter HTTP $1.5/GB
Sneaker Bots Residential + ISP HTTP $2.7/GB
Geo-restricted content (Netflix) Residential HTTPS/SOCKS5 $2.7/GB
SEO Rank Tracking Residential HTTP $2.7/GB
Ad Verification Residential HTTP $2.7/GB
API Testing (development) Datacenter HTTP/SOCKS5 $1.5/GB

โšก Proxy Performance Optimization

Best Practices 2025

โœ… Connection Pooling

Reuse TCP connections. HTTP Keep-Alive saves 100-200ms on every request.

โœ… HTTP/2 Support

Use HTTP/2 for multiplexing multiple requests over a single connection.

โœ… Geo-Proximity

Choose proxies geographically close to the destination server. Latency = distance.

โœ… DNS Caching

Cache DNS lookups on the client side. DNS lookup takes 20-50ms.

โœ… Retry Logic

Automatic retries on 5xx errors with exponential backoff and switching to a different proxy.

โœ… Session Persistence

For session-based tasks, use sticky sessions (one IP for the entire session).

โš ๏ธ What to Avoid

  • โŒ Using free proxies (slow, insecure, unstable)
  • โŒ Setting rate limits too high (you will get captchas and blocks)
  • โŒ Using one proxy for all requests (fingerprinting, IP blocking)
  • โŒ Ignoring retry-after headers (server rate limiting)
  • โŒ Using HTTP proxies for sensitive data

๐ŸŽ“ Conclusion

Proxy servers are a powerful tool that, in 2025, has become an integral part of the modern internet. Understanding how they work gives you a competitive edge in many areas.

๐Ÿ”‘ Key Takeaways

1. Architecture

A proxy is a smart intermediary that actively processes, caches, and optimizes traffic, rather than just forwarding data.

2. Protocols

HTTP for web traffic, SOCKS5 for versatility, CONNECT for HTTPSโ€”each protocol serves a specific purpose.

3. Security

TLS 1.3 with ECH protects against DPI. The CONNECT method preserves end-to-end encryption. Always use HTTPS.

4. Performance

Caching accelerates loading by 50-90%. Load balancing distributes traffic for high availability.

5. Type Selection

Residential for evasion, Mobile for social media, Datacenter for simple tasks. The right choice equals project success.

6. Modern Trends

HTTP/3, QUIC, ECH (Encrypted Client Hello), AI-powered routingโ€”proxies evolve with the internet.

๐Ÿš€ Next Steps

  1. Practice: Configure a proxy in your project and test different protocols
  2. Monitoring: Track metrics (hit rate, latency, error rate)
  3. Optimization: Experiment with caching and balancing settings
  4. Security: Regularly check logs for anomalies
  5. Scaling: Add proxy servers as load increases

๐Ÿ’ก Remember: A proxy is not magic, but an engineering tool. Understanding its operation allows you to use it effectively, avoid errors, and achieve maximum performance. In 2025, a correctly configured proxy is a competitive advantage.

Ready to Apply Your Knowledge in Practice?

Now you are an expert on proxy servers! Apply your knowledge with ProxyCove.
195+ countries, all protocols, premium quality, 99.9% uptime.
Register with promo code ARTHELLO = +$1.3 bonus to start

ProxyCove Plans 2025:

โœ… HTTP, HTTPS, SOCKS5 | โœ… API + Dashboard | โœ… 24/7 Support | โœ… Instant activation

๐Ÿ“š The Complete Guide to Proxy Servers is Finished!

You have studied:
Part 1: Basics, architecture, forward vs reverse, transparent vs explicit
Part 2: HTTP/SOCKS protocols, CONNECT method, SSL/TLS handshake, headers
Part 3: Caching, load balancing, practical examples, optimization

๐ŸŽ‰ Congratulations! You now understand how proxy servers work in 2025.