Architectural Breakdown & AnalysisFAANG Aligned
An API Gateway acts as the single secure entry point for all client requests into internal microservices.
Core Edge Responsibilities
- SSL/TLS Termination: Decrypts HTTPS at the gateway edge, passing unencrypted HTTP/TCP internally to reduce CPU load on microservices.
- Reverse Proxy & Routing: Maps external URI paths (
/api/v1/orders) to internal service IPs using Service Discovery (Eureka/Consul). - Cross-Cutting Concerns: Enforces central rate limiting, CORS headers, security payload sanitization, and request tracing headers (
X-Request-ID).
NOTE — Recommended Tech Stack
Leverage battle-tested reverse proxies like Envoy, Kong (Lua/OpenResty), or Nginx for edge gateway deployments.
Key Architectural Comparison
| Gateway Feature | L4 Proxy (HAProxy / NLB) | L7 Gateway (Kong / Envoy / APISIX) | In-App Middleware |
|---|---|---|---|
| Routing Granularity | IP address & TCP/UDP port only. | HTTP Path, Method, Headers, Cookies. | Internal method calls. |
| SSL / TLS Termination | Fast hardware pass-through. | Full certificate termination & inspection. | None. |
| Authentication & JWT | Not supported. | Centralized token validation & rate limiting. | Duplicated across each service. |
| Latency Overhead | Sub-millisecond. | 2–5 milliseconds. | Zero network overhead. |