Okay, let's briefly review 2.4.d Proxy Servers to clarify their role in relation to other components like Load Balancers and API Gateways.

  • Definition (General): A proxy server acts as an intermediary for requests between clients and servers. It sits between the two, forwarding requests and responses.

  • Two Main Types: The key distinction lies in who the proxy is acting on behalf of:

    1. Forward Proxy:

      • Acts on behalf of: Clients.
      • Location: Sits in front of one or more client machines.
      • Purpose: Forwards outgoing requests from clients to various servers on the internet or internal network.
      • Use Cases:
        • Bypassing geographic restrictions or censorship.
        • Filtering outbound content (e.g., in schools or corporations).
        • Caching common requests for a group of clients.
        • Providing a single source IP address for multiple clients (improving security/anonymity for clients).
      • Visibility: The destination server sees the request coming from the proxy server, not necessarily the original client.
    2. Reverse Proxy:

      • Acts on behalf of: Servers.
      • Location: Sits in front of one or more backend servers.
      • Purpose: Receives incoming requests from clients and forwards them to the appropriate backend server(s).
      • Use Cases (Many overlap with LB/Gateway):
        • Load Balancing: Distributing client requests across multiple backend servers.
        • SSL/TLS Termination: Decrypting incoming HTTPS traffic and encrypting outgoing traffic, offloading this task from backend servers.
        • Caching: Storing frequently requested content from backend servers to serve clients faster.
        • Compression: Compressing responses to reduce bandwidth usage.
        • Security: Hiding the identity/IP addresses of backend servers, acting as a single point for security checks (e.g., Web Application Firewall - WAF).
        • Serving Static Content: Directly serving static files (images, CSS, JS) instead of burdening application servers.
      • Visibility: The client typically interacts only with the reverse proxy, often unaware of the specific backend server(s) handling the request.
  • Relationship to Other Patterns:

    • Load Balancers: Most load balancers function as Reverse Proxies. Their primary focus is distributing traffic, but they often perform other reverse proxy tasks like health checks and SSL termination.
    • API Gateways: API Gateways are essentially specialized Reverse Proxies tailored for managing API traffic. They perform standard reverse proxy tasks (routing, SSL termination, load balancing) but add API-specific features like authentication, rate limiting, request/response transformation, and API composition.
    • CDNs: Use a network of geographically distributed Reverse Proxies (edge servers) to cache content closer to users.
  • In an Interview: Understand the fundamental difference between forward (client-side) and reverse (server-side) proxies. Recognize that load balancers and API gateways are typically implemented as reverse proxies, inheriting their capabilities and adding specialized functions.

Advertisement