Proxy
A proxy is a structure where clients and servers do not communicate directly but go through an intermediary server. A forward proxy controls outbound access from the client side, while a reverse proxy receives incoming requests on the server side and distributes them to backend servers. Functions like caching, access control, TLS termination, and routing can be handled at this middle layer instead of in each application.
βΆArchitecture Diagram
π RelationshipDashed line animations indicate the flow direction of data or requests
A direct client-to-server architecture is simple, but as a service grows it hits several problems. If the server IP is directly exposed, building a security boundary is difficult. If there are multiple backend servers and clients need to know individual addresses, every server change forces a client-side update. Having the origin server repeatedly send the same static response thousands of times is wasteful, and leaving employees free to access anything external without controls is an operational risk. Solving these problems in each application individually creates code duplication and management sprawl, and every policy change means touching every service. A proxy gathers this burden into a single intermediary layer between clients and servers.
In the early internet and web, the default model was simple direct connection: clients talked to individual servers. When services were small and server counts were low, that was manageable. But in the 1990s, as corporate networks expanded, companies needed a way to record, filter, and control employees' outbound web access. That pressure led to the widespread use of forward proxies. Instead of letting every client go straight to the internet, organizations sent traffic through an intermediate server where access policy and caching could be enforced centrally. By the late 1990s and early 2000s, a different pressure grew on the server side. Websites were getting larger, multiple applications were being served behind one domain, and teams wanted to centralize SSL termination instead of managing certificates separately on each backend. In that environment, software such as Apache, Nginx, and HAProxy helped reverse proxies become a standard front layer for web infrastructure. Later, as cloud platforms and microservice architectures spread, proxies evolved again beyond simple request relay into core infrastructure for API gateways, ingress layers, and sidecar proxies in service meshes, where they enforce traffic policy and service-to-service communication rules.
A proxy is an intermediary server that sits between clients and servers, exchanging requests and responses on their behalf. There are two main directions. A forward proxy sits on the client side and relays users' outbound requests. It is used to block access to certain sites from a corporate network, hide users' real IPs, or cache repeated requests to save bandwidth. A reverse proxy sits on the server side and receives incoming requests from the outside. Clients only need to know the reverse proxy's address; how many servers are behind it and which path goes where is the proxy's decision. A reverse proxy routes to the appropriate backend based on URL path or host header, manages TLS certificates in one place so internal servers only need to handle plaintext, and caches frequently requested responses to reduce origin load. Because these functions are concentrated in one layer, adding or replacing backend services does not change the entry point that clients see. This is why tools like Nginx, HAProxy, and Envoy are widely used as reverse proxies.
Path-based routing and TLS termination in a reverse proxy
server {
listen 443 ssl;
server_name app.example.com;
ssl_certificate /etc/ssl/cert.pem;
ssl_certificate_key /etc/ssl/key.pem;
location /api/ {
proxy_pass http://api-service;
}
location / {
proxy_pass http://web-service;
}
}Clients only see `app.example.com`, but the proxy terminates TLS here and sends `/api` to the API backend while routing everything else to the web backend. This is what the structure section means by a single entry point, TLS termination, and path-based routing.
Proxies, load balancers, and CDNs all relay traffic between clients and servers, and in practice a reverse proxy often performs load balancing and caching together. But the core problem each one solves is different. The essence of a proxy is relay itself: intercepting, inspecting, transforming, and routing requests as a general-purpose intermediary whose strength is flexible policy enforcement like access control, protocol translation, and header modification. A load balancer specializes in distributing requests evenly across multiple replicas of the same service, with health checks and failover at its core. A CDN focuses on caching content at geographically distributed edges to reduce latency caused by physical distance. For a small service, one reverse proxy handling routing, TLS termination, and simple distribution is natural, but as the service grows, separating each concern into a dedicated layer tends to be better for operations and fault isolation.
A proxy gives you a strong operational advantage: backend changes and shared policies can be concentrated behind one entry point. TLS termination, path routing, caching, and access control move into a common layer so each application can stay focused on its own business logic. The cost is that this layer becomes a center of operational complexity. If the proxy fails, the whole front door is affected unless you add redundancy and monitoring, and every extra hop adds a small amount of latency. As systems grow, the real design question becomes whether the benefit of centralizing policy is greater than the cost of concentrating too much responsibility in one place. Proxies are highly valuable when you need one stable entry point and shared control, but in a small service an overgrown proxy configuration can make failures harder to understand than the original problem.
A reverse proxy appears almost naturally when you have two or more backend services, need to serve different services by path behind one domain, or want to manage TLS certificates in one place. In container-based deployment environments, an ingress controller is essentially a reverse proxy. Forward proxies are used in corporate networks to control external access, or in test environments to intercept and mock external API calls.