What is an API gateway and what responsibilities does it handle?
Answer
An API gateway is a server that acts as the single entry point for all client requests, routing them to appropriate backend services. It handles cross-cutting concerns so individual services do not have to: Authentication and authorization (validate JWTs or API keys before requests reach services), rate limiting (enforce per-client limits centrally), request routing (route /v1/users to the Users service, /v1/orders to the Orders service), SSL termination (handle HTTPS, forward as HTTP internally), load balancing (distribute traffic across service instances), request/response transformation (adapt legacy APIs to REST conventions), logging and tracing (add correlation IDs, emit metrics), and caching (cache common responses). Popular API gateways include AWS API Gateway, Kong, Nginx, and Apigee.
Previous
What are the best practices for filtering, sorting, and searching in REST APIs?
Next
How do webhooks work and what are the delivery guarantees?
More REST API Design Questions
View all →- Intermediate What is HATEOAS and how is it implemented?
- Intermediate What are the main API versioning strategies in REST and what are their tradeoffs?
- Intermediate What are the pagination strategies in REST APIs?
- Intermediate What is rate limiting and how is it communicated in REST APIs?
- Intermediate How does HTTP caching work in REST APIs with ETag and Cache-Control?