Architecture & System Design › Cloud Design Patterns
Gateway Offloading
Moving TLS, auth and other shared concerns into the gateway.
Also known as: gateway offloading, edge offload, gateway ssl offload
Gateway offloading moves cross-cutting work from services into the gateway: TLS termination, authentication, rate limiting, caching, compression, request validation — implemented once at the edge, inherited by every service behind it. Services focus on business logic; the gateway absorbs the undifferentiated HTTP heavy lifting.
client → gateway (TLS, auth, limit, cache, validate) → lean service (logic only)
The economy is obvious (implement once, not N times) and the consistency valuable (uniform auth, uniform limits, uniform observability). The risk is the gateway becoming critical infrastructure with product logic ambitions — scope discipline keeps it infrastructure.
The classic mistakes:
- Product logic offload. Validation schemas encoding business rules, routing encoding product decisions — gateway config becomes untested application code. Offload transport concerns; keep meaning in services.
- Single gateway bottleneck. All cross-cutting work centralised without scaling, redundancy and shedding turns the helper into the SPOF. Operate it like the critical path it is.
- Inconsistent bypasses. Some services reachable around the gateway (direct ingress, debug routes) skip auth and limits entirely. All traffic through, or explicitly exempted with reason.
- Opaque failures. Gateway rejections (auth, limits, validation) without clear errors and metrics leave clients and teams guessing. Reject loudly with actionable signals.
- Config drift across environments. Gateway policy differing subtly between staging and prod (“works in staging”) bites at the worst moments. Manage gateway config as versioned code, promoted like code.
- Over-caching. Aggressive gateway caching serving stale or personalised content wrongly trades correctness for speed. Cache deliberately (keys, TTLs, private boundaries).
- Version lock-in. Gateway features (proprietary auth, custom DSLs) coupling all services to one vendor complicate migration. Prefer standard mechanisms at the boundary.
How to offload: transport and policy at the edge (TLS, auth, limits, cache, validation of shape), business logic in services, everything as versioned config. Shared concerns, solved once, operated seriously.