DEV Community

Phoenix
Phoenix

Posted on

Proxy - Forward Proxy and Reverse Proxy

A proxy server is an intermediary piece of hardware/software acts like a middlemen sitting between the client and the backend server. It receives requests from clients and relays them to the origin servers.

2 types of Proxy
Forward Proxy -works for clients
Reverse Proxy works for servers

Forward Proxy
A forward proxy sits in front of clients and internet. It hides the client's identity from the server. When those clients make requests to sites and services on the internet, the proxy server intercepts those requests and then communicates with web servers on behalf of those clients, like a middleman.
Think of a VPN or corporate proxy: the server sees the proxy's IP, not yours. Use cases include privacy, content filtering, and bypassing geo-restrictions.

-> works at application level(http/https)

Advantages of a forward proxy:

  • Block access to certain content
  • it does security filtering, by stoping from downloading or opening malicious content before it reaches the server
  • tracks monitoring and logging of which websites visited and usage
  • Stores copies of frequently visited websites
  • Reduces internet usage and speeds things up
  • Provides anonymity
  • Access blocked content (in some cases)

VPN:
Used to securely and privately route all network traffic through an encrypted tunnel.

VPN and forward proxy serve different purposes. VPN provides secure encrypted communication, while forward proxy provides control and filtering. They are often used together in enterprise environments

Reverse Proxy

A reverse proxy sits in front of servers and internet. It hides the server's identity from the client. this proxy intercepting requests from clients. When clients send requests to the origin server of a website, those requests are intercepted by the reverse proxy server. The client thinks it is talking to one server, but the reverse proxy could be routing requests to dozens of backend servers.

_A reverse proxy is not just a load balancer, but it can perform load balancing along with other functions like caching, SSL termination, and security.
_
Advantages of a forward proxy:

  • Distributes traffic across multiple servers
    Example:
    Amazon
    Netflix
    Millions of users β†’ reverse proxy spreads load

  • Security (very important)
    Hides real server IPs
    Blocks malicious traffic
    Acts as first line of defense
    Example:
    Cloudflare sits in front of websites

  • Caching (performance boost)
    Stores frequently requested data
    Sends it quickly without hitting backend

  • not very data, only public/static content shared across users

  • reduce latency and improve performance
    Example:
    Homepage loads faster because proxy cached it

  • SSL/TLS Termination
    Handles HTTPS encryption
    Backend servers don’t need to handle it
    Example:
    NGINX manages HTTPS

1. Cloudflare (outer layer)
Sits on the internet edge
First point of contact for users worldwide
What it does:
🌍 CDN (serves content from nearest location)
πŸ›‘οΈ DDoS protection
πŸ”’ SSL (HTTPS)
🚫 Blocks malicious traffic

πŸ‘‰ Think of it as:
Global security + performance layer

** 2. NGINX (inside your system)**
Runs on your server or infrastructure
What it does:
πŸ”€ Routes requests to backend services
βš–οΈ Load balancing
πŸ” SSL termination (if not handled by Cloudflare)
⚑ Caching

πŸ‘‰ Think of it as:
Internal traffic manager

Top comments (0)