Skip to main content

Someone wanted to learn this too, so Grasp built them a personal learning path.

You can keep exploring this one or create your own

Proxy Architectures: Types, Uses, and Security Implications

Hello! Welcome to the first lesson of your course on designing security products.

Given your background in software engineering and your goal to understand the "first principles" of how security systems are architected, we're going to start with the most fundamental building block in network security: the proxy. Almost every security product that inspects traffic in real-time, from a Web Application Firewall (WAF) to a Zero Trust Network Access (ZTNA) gateway, is built on a proxy architecture.

In this lesson, you will learn to compare forward, reverse, and transparent proxy architectures and identify their use cases in security products. Understanding these three patterns is crucial, as we will see them appear repeatedly as we architect more complex systems throughout this course.

Let's begin by establishing a clear definition for the two most common proxy types.

1. Forward vs. Reverse Proxies: A Tale of Two Middlemen

At its core, a proxy is simply an intermediary that acts on behalf of another machine. The key difference between a forward and a reverse proxy lies in who they act for and where they sit in the network.

To get a clear visual and conceptual overview, please watch the following video from ByteByteGo. It provides an excellent high-level introduction to these concepts.

Proxy vs Reverse Proxy (Real-world Examples)

This video provides a concise explanation of forward and reverse proxies, their placement in a network, and their common use cases.

Please watch the sections on 'Forward Proxy' (00:17 - 01:48) and 'Reverse Proxy' (02:21 - 04:19). Pay close attention to who the proxy is serving (the client or the server) and the benefits it provides in each case.

As the video illustrates, the distinction is all about perspective:

  • Forward Proxy: Sits between internal clients and the public internet. It acts on behalf of the clients. Its primary purpose is to protect or control the clients.
    • Security Use Cases: Anonymizing clients, bypassing regional restrictions, and, critically for enterprise security, outbound content filtering (e.g., blocking employees from accessing malicious sites).
  • Reverse Proxy: Sits between the public internet and a company's web servers. It acts on behalf of the servers. Its main job is to protect and manage access to those servers.
    • Security Use Cases: Protecting servers from direct attack (hiding their IP addresses), DDoS mitigation, and serving as a platform for a Web Application Firewall (WAF) to inspect incoming requests.

This image provides a clear side-by-side comparison of their network placement and purpose.

Forward Proxy Versus Reverse Proxy
This diagram contrasts the forward proxy, which serves clients inside a network, with the reverse proxy, which serves applications inside a network. They are mirror images in terms of their architectural position.

2. The Full Proxy: An Architectural Deep Dive

You now know what these proxies do, but your goal is to understand how to build them. How does a proxy actually inspect and manipulate traffic? The key lies in an architectural pattern known as a full proxy.

This is a critical concept for building security products. A simple packet-forwarding device can't inspect encrypted traffic or modify application-layer data. A full proxy can.

The next video explains this fundamental architectural pattern. It differentiates between a "half proxy" (simple connection forwarding) and a "full proxy" (which enables deep inspection).

What is a Proxy?

This video from F5, a major networking and security company, explains the crucial architectural difference between a simple proxy and a 'full proxy' which is the foundation for most modern security inspection.

Please watch the sections explaining the 'full proxy' (03:10 - 05:16), its application as a 'reverse proxy' for security (05:16 - 07:48), and its use as a 'forward proxy' (07:48 - 09:57). Focus on the concept of two separate TCP connections and the 'gap' it creates for inspection.

The core principle of a full proxy architecture is this:

  1. The proxy establishes a connection with the client and terminates it. The client thinks it's talking directly to the server.
  2. The proxy then establishes a completely separate connection to the server. The server thinks it's talking directly to the client (or at least, to the proxy).

This creates an "air gap" between the two connections, right in the middle of the proxy. Within this gap, the proxy has full access to the unencrypted application-layer data (like HTTP requests). This is where the magic happens. A WAF can inspect the HTTP payload for SQL injection, an outbound filter can check URLs against a blocklist, and an SSL offloader can handle the expensive cryptography.

From a system design perspective, you can think of the full proxy as a network-level implementation of the interceptor pattern.

3. Transparent Proxies: The Invisible Intermediary

Both forward and reverse proxies typically require some form of configuration. A client's browser must be told to use a forward proxy. DNS records must be pointed to a reverse proxy. But what if you want to force traffic through a proxy without any configuration on the client or server? This is where transparent proxies come in.

A transparent proxy intercepts network traffic at a lower level (typically Layer 4, the transport layer) and redirects it to a proxy process, all without the client or server being aware of it.

Let's explore how this works.

How Istio's “Ambient Mode” Transparent Proxy—tproxy—Works ...

This article from Tetrate provides a great explanation of how transparent proxies work, distinguishing them from non-transparent ones and diving into the low-level mechanics.

Please read the sections titled 'Proxy Types' and 'Using the tproxy Transparent Proxy'. The first section clearly defines the difference between transparent and non-transparent proxies. The second gives a concrete example of how this is implemented in Linux using iptables and tproxy, which will appeal to your interest in system internals.

The key difference is how the network packets are handled. In a non-transparent proxy, the destination IP address of the client's packet is the proxy itself. In a transparent proxy, the client sends a packet with the final server as the destination, but a network device (like a router or a host's own networking stack) intercepts it and redirects it to the proxy.

This image from the article you just read makes the distinction clear at the IP packet level.

Non-transparent vs. Transparent Proxy IP Handling
This diagram shows that with a non-transparent proxy, the client sends packets to the proxy's IP address (B). With a transparent proxy, the client sends packets to the final server's IP address (C), but the packets are invisibly intercepted and processed by the proxy (B) while preserving the original source and destination IPs.

The use of iptables in Linux is a perfect example of this principle. By setting up rules in the networking stack, you can match specific traffic (e.g., all outbound HTTP traffic on port 80) and redirect it to a local proxy process for inspection, without any application needing to be aware of the interception.

Use Cases in Security:

  • Forced Web Filtering: In a corporate or school network, a transparent forward proxy can ensure all user web traffic is filtered, even if users don't configure their browsers.
  • Service Mesh: In modern cloud-native environments (like Kubernetes with Istio), transparent sidecar proxies intercept all inbound and outbound traffic for a service, enabling fine-grained security policies, encryption (mTLS), and observability without modifying the application code.

4. Real-World Architecture: Chaining Proxies for Defense in Depth

These proxy patterns are not mutually exclusive. In fact, sophisticated security architectures often chain them together to create multiple layers of inspection. Let's analyze a real-world example from Microsoft Azure.

In this scenario, we have two security products working together:

  1. Azure Application Gateway (with WAF): A reverse proxy that protects web servers.
  2. Azure Firewall Premium: A next-generation firewall that can inspect traffic.

Read the following to see how they are combined, and pay attention to how each one is classified as a specific proxy type.

Implement a Zero Trust Network for Web Applications by Using ...

This Microsoft Azure architecture document describes a 'defense in depth' pattern for web applications. It provides a superb, practical example of how reverse and forward proxies are used in tandem.

Please read the sections 'Digital certificates' and 'Component roles'. The 'Component roles' section explicitly defines the Application Gateway as a reverse proxy and the Azure Firewall as a forward proxy. The 'Digital certificates' section explains the complex TLS handshake flow, which is a direct consequence of this chained full-proxy architecture.

This architecture is a fantastic illustration of our concepts in action:

  1. Azure Application Gateway acts as a reverse proxy. It faces the public internet, terminates the initial TLS connection from the user, inspects the HTTP request with its WAF rules, and then decides whether to forward the request.
  2. Azure Firewall Premium acts as a forward proxy. But who is its "client"? The Application Gateway! It intercepts the traffic sent from the Application Gateway, decrypts it again for its own inspection (e.g., Intrusion Detection), and then creates a final, third TLS connection to the backend application server.

This layered approach allows each component to specialize. The reverse proxy handles web-specific threats, while the forward proxy behind it handles more general network-based threats. This highlights that proxy patterns are fundamental building blocks that can be composed in powerful ways.

Conclusion

In this lesson, we've established a foundation for understanding the core architectural patterns of network security products.

Key Takeaways:

  • Forward Proxy: Acts for the client. Use cases include outbound filtering and client anonymity.
  • Reverse Proxy: Acts for the server. Use cases include WAF, load balancing, and DDoS protection.
  • Transparent Proxy: Intercepts traffic at the network layer without client/server awareness. It's a method of deployment for either forward or reverse proxies.
  • Full Proxy Architecture: The mechanism that makes deep inspection possible by terminating and re-establishing connections, creating a space for security logic to operate on unencrypted data.

Preview of the Next Lesson:

Now that you understand how proxies intercept traffic, the next logical question is: what do they do with it? In the next lesson, we will design a generic rule/policy engine. This is the "brain" of a security product. We'll explore how to architect a system that can take the data from a proxy, apply a set of rules (like WAF signatures), and make a decision—a crucial step in building any of the security products you're interested in.

Can't find a good explanation? Sign up and we'll make it for you

Sign up