Problem
Invalid payloads, oversized bodies and malicious input reach backends, wasting compute and exposing each service to injection and parsing attacks. Every team re-implements similar validation with inconsistent results.
Also known as: gateway-validation, schema-validation-at-edge
Reject malformed or abusive requests at the gateway before they reach backend services.
Invalid payloads, oversized bodies and malicious input reach backends, wasting compute and exposing each service to injection and parsing attacks. Every team re-implements similar validation with inconsistent results.
Validating requests at the edge means the gateway checks structure and limits before traffic reaches any service. Obviously bad requests cost almost nothing to reject, and backends see a cleaner stream of input.
The gateway loads the API contract and applies it per route. A failing request never leaves the edge.
client -> gateway
1. TLS, auth, rate limit
2. size limit (e.g. 1 MB), content-type check
3. validate body against OpenAPI schema for POST /orders
4a. invalid -> 400 {"error":"items must be an array"}
4b. valid -> route to orders-service
Typical checks include allowed methods, required headers, JSON well-formedness, field types, string length and pattern, numeric ranges and maximum array sizes. Publishing schemas from the same OpenAPI file used to generate service stubs keeps both layers aligned. Services still validate again, since they may also receive traffic from queues or internal callers.
Low - gateway feature
Medium - schema and config pipeline
Low - well-understood
Edge schema out of sync rejects valid requests after a release
Validation skipped on internal paths, leaving services exposed
Body buffering of large payloads exhausts gateway memory