Api Gateway medium
In your API Gateway monitoring, you observe a massive spike in `502 Bad Gateway` errors. However, the health logs of your backend microservices show they are 100% 'Healthy'. What is the most likely cause?
- A The backend services are throwing `500 Internal Server Error`, which the Gateway translates to 502.
- B The network connection between the Gateway and the services is being blocked (e.g., an internal firewall rule change or a VPC routing issue).
- C The clients are sending invalid API keys that the Gateway cannot recognize.
- D The database has run out of physical disk space.
Answer: B. The network connection between the Gateway and the services is being blocked (e.g., an internal firewall rule change or a VPC routing issue).
A 502 error specifically means the Gateway acting as a proxy received an 'invalid response' or 'no response' when trying to connect to the backend. If the backends are healthy, the issue is 'connectivity'. This usually points to network hurdles like Security Groups or faulty internal load balancers.
One system design question a day, with spaced repetition so the ones you miss come back.
Get the appRelated questions
- Your Gateway communicates with backends via HTTP/1.1 connections. A slow backend service causes 'Head-of-Line Blocking'. How does switching to HTTP/2 as the Gateway-to-Backend transport mitigate this?
- What is the primary architectural role of an API Gateway in a microservices environment?
- Why is 'Stateless Token Validation' (e.g., using JWTs) significantly more scalable at the Gateway level than 'Stateful Validation' (e.g., using Opaque/Reference Tokens)?
- Your Gateway is configured to cache any URL ending in `.css` or `.jpg`. An attacker tricks a victim into visiting `https://api.com/v1/profile/info/style.css`. How can this lead to an 'Account Takeover'?
- An API is receiving a sudden surge of 10,000 requests per second from a single IP address. How does an API Gateway preserve the stability of the backend services?
- How can an API Gateway help prevent 'Double Charging' in a payment system when a mobile client retries a failed request due to a poor connection?