Reverse Proxy
-
A reverse proxy is a server that stands in front of your application servers, recieves all client requests and forwards them to correct backend server
-
Analogy
Guest --> Reception Desk
--> Room Service
--> House Keeping
--> Restaurant
| Problems without Reverse Proxy |
How Reverse Proxy Helps |
| Client should know every server ip |
Hides backend servers |
| Hard to add/remove serves |
Backend can change freely |
| No traffic control |
smart rouging is possible |
| No central security |
SSL, auth, filtering all at one place |
Load Balancer
- A Load Balancer is a type of reverse proxy that distributes incoming requests across multiple backend servers
- Reverse Proxy vs Load Balancer
| Reverse Proxy |
Load Balancer |
| Forwards requests |
Distributes Requests |
| Can route based on URL, headers |
Chooses server based on Algorithm |
| Focus on abstraction |
Focus on scalability and performance |
| May have single backend |
Always have multiple backends |
Every Load balancer is a reverse proxy, but not each reverse proxy is a load balancer

- LB Algorithms
- Round robin: Gives turns one by one
- Least Connections: Gives work to the least busy server
- IP Hash: Same USer -> same server
- Weighted: Stron server gets more traffic.

Load Balancers according to OSI
- In real systems load balancers mostly work at Layer 7 and Layer
Layer 4 Loadbalancer
- What it understands
- What it does not see
- Characteristics
- Very fast
- Handles huge traffic
- No smart Route
- Typical use cases
- Database Servers
- Game Servers
- Non HTTP Traffic
- High performace systems
Layer 7
- What it understands
- URLs
- HTTP Headers
- Cookies
- Host Names
- HTTP MEthods
- It can forware the traffic based on context of request
- Example: if the request contains
/api/* forward theme to Api Servers
/admin/* forward them to admin servers
/login/* forward them to identity servers
/images/* forward to blob/image server
- Key characteristics
- Smart routing
- SSL Termination
- Authentication possible
- Slightly slower than layer 4
- Refer Here for de
Like this:
Like Loading...