Menu

Earn Premium with Referrals

Invite your friends and earn Premium rewards through our referral program.

See how it works and start inviting friends.

Proxies & CDNs
CN

Proxies & CDNs

Master forward proxies, reverse proxies, and how CDNs deliver content globally.

Forward Proxy

A forward proxy sits between clients and the internet. Clients know they’re using a proxy (configured manually or via PAC).

Client → Forward Proxy → Internet → Web Server

Uses:

  • Access control: restrict which sites employees can visit
  • Anonymity: hides the client’s IP from the server
  • Caching: reduce bandwidth by caching frequently accessed content
  • Bypassing restrictions: access geo-blocked content

Reverse Proxy

A reverse proxy sits in front of web servers, handling incoming client requests. Clients don’t know the proxy exists — they think they’re talking directly to the backend.

Client → Internet → Reverse Proxy → Backend Server

Uses:

  • Load balancing: distribute requests across multiple backends
  • SSL termination: handle HTTPS, send HTTP to internal servers
  • Caching: serve cached responses without hitting the backend
  • Security: hide backend topology, absorb DDoS, filter malicious requests
  • Compression: compress responses before sending to clients

Popular reverse proxies: Nginx, HAProxy, Apache httpd, Caddy, Envoy.

CDN (Content Delivery Network)

A CDN is a network of geographically distributed servers that cache and deliver content. It’s essentially a reverse proxy network.

BenefitHow it works
Low latencyUsers connect to nearest edge server instead of origin
High availabilityEdge servers handle traffic; origin can be offline
DDoS protectionAttack traffic is absorbed across thousands of edge nodes
Bandwidth savingsCached responses don’t need to hit the origin

Origin pull: When a user requests content not in cache, the edge server fetches it from the origin and caches it (configurable TTL). Subsequent requests for the same content are served from cache.

Examples: Cloudflare, Akamai, Fastly, AWS CloudFront, Google Cloud CDN.

Forward vs Reverse Proxy Summary

Forward ProxyReverse Proxy
Sits in front ofClientsServers
Known to clientYesNo (transparent)
HidesClient identityServer topology
Use caseCompany internet gatewayWeb server front-end

Q: What’s the difference between a forward and reverse proxy?

A: A forward proxy sits in front of clients (hides the client from the server). A reverse proxy sits in front of servers (hides the server from the client). Forward proxies are used for access control/anonymity; reverse proxies for load balancing, SSL termination, and caching.

Q: How does a CDN work?

A: Content is cached on edge servers distributed around the world. When a user requests a resource, DNS routes them to the nearest edge server. If the edge has it cached, it’s served instantly. If not (cache miss), the edge fetches from the origin, caches it, and serves the user.

Q: What are the main benefits of a CDN?

A: Lower latency (geographic proximity), higher reliability (distributed infrastructure), DDoS protection (absorbs attacks), bandwidth savings (offloads origin servers), and global scalability.

Q: Can a reverse proxy be used as a load balancer?

A: Yes. Nginx and HAProxy are both reverse proxies and load balancers. They can distribute requests across multiple backend servers using algorithms like round robin or least connections.

My Private Notes

Notes are auto-saved locally to this device.