No history yet

Introduction to Reverse Proxies

The Internet's Receptionist

Think of a large company with hundreds of employees. If you wanted to call someone there, you wouldn't need to know their personal extension. You'd call the main switchboard, and a receptionist would connect you to the right person. The receptionist is the public face of the company, managing all incoming calls to ensure they reach their destination smoothly.

A reverse proxy does the same job, but for web servers. It sits in front of one or more servers, acting as a single point of contact for all incoming traffic from the internet. When you visit a website, your request goes to the reverse proxy first. The proxy then forwards your request to the appropriate backend server, gets the response, and sends it back to you.

A reverse proxy is a server that exists between a web server and clients, intercepting connection requests from clients and sending them to the intended backend server.

From your perspective as a user, this entire process is invisible. You type in www.example.com, and you get a webpage. You have no idea that your request was handled by an intermediary. The reverse proxy hides the complexity of the internal network, making the whole system more secure and efficient. The backend servers, which hold the actual website data, are never directly exposed to the internet.

Forward vs. Reverse Proxy

The term "proxy" can be confusing because there are two main types: forward and reverse. They both act as intermediaries, but they serve opposite purposes and protect different parties.

Proxy

noun

A server application that acts as an intermediary for requests from clients seeking resources from other servers.

A forward proxy sits in front of a client or a group of clients (like on a school or corporate network). It acts on behalf of the client, forwarding their outgoing requests to the internet. The servers on the internet see the request coming from the proxy, not the original client. This is often used to enforce security policies, cache data, or hide the client's IP address.

A reverse proxy, on the other hand, sits in front of servers. It acts on behalf of the server, accepting incoming requests from clients on the internet. The client thinks it's communicating directly with the website's server, but it's actually talking to the reverse proxy. This setup protects the backend servers and allows for powerful features like load balancing and caching.

In short: A forward proxy represents the client. A reverse proxy represents the server.

This diagram illustrates the core difference. The forward proxy acts for the client, sending requests out. The reverse proxy acts for the servers, taking requests in.

How It Works

Let's walk through a simple request to a website that uses a reverse proxy.

  1. You type www.example.com into your browser. Your browser sends a request to the IP address associated with that domain name.
  2. This IP address does not belong to the web server that hosts the site. Instead, it belongs to the reverse proxy server.
  3. The reverse proxy receives the request. It looks at the request details (like the domain name being requested) and decides which internal, backend server should handle it.
  4. The proxy forwards the request to the selected backend server. This backend server is on a private network and is not directly accessible from the internet.
  5. The backend server processes the request (for example, by fetching the homepage's HTML file) and sends the response back to the reverse proxy.
  6. The reverse proxy receives the response from the backend server and forwards it back to your browser.

To you, it's a seamless experience. But behind the scenes, the reverse proxy has managed the connection, protected the backend servers, and ensured your request was handled correctly.

Lesson image

This basic operation is the foundation for many of the web's most critical functions, from balancing traffic across massive server farms to providing a secure gateway for web applications.

Quiz Questions 1/5

What is the primary role of a reverse proxy in a web architecture?

Quiz Questions 2/5

In a network that uses a reverse proxy, which component is directly exposed to the public internet?