1. When a frontend page requests a frontend interface and the response times out, it sometimes returns a 504 (as expected) and sometimes a 404 (unexpected). See Figure 1.

{
"_request_time": "60.004",
"_status": "404"
}
2. Querying the ingress-nginx logs based on _request_id:004c4f55c16c0904759fdb580d7c5df9, there is one record in ingress-nginx-controller (10-14 16:01:33) with a 404 response. See Figure 2.

3. Querying the Frontend Service logs based on _request_id:004c4f55c16c0904759fdb580d7c5df9, there is one record in Frontend Service (10-14 16:01:33) requesting /50x.html with a 404 response and _upstream_status:504, indicating that Backend Service responded with 504. See Figure 3.

4. Querying the Backend Service logs based on _request_id:004c4f55c16c0904759fdb580d7c5df9, there is one record in Backend Service (10-14 16:01:33) with a 504 response; because Frontend Service actively disconnected, the actual recorded response is 499. See Figure 4.

5. Checking the Nginx configuration of Frontend Service. Because the 50x.html page does not exist, it results in a 404 response. We finally decided to comment out the related configuration items. See Figure 5.

# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
6. Analysis conclusion: If the frontend service (frontend-svc-80) is waiting for a response from backend-svc-80, and backend-svc-80 responds too slowly, the client will actively close the connection after receiving a 404 response, causing Backend Service Nginx to log a 499 status code.
7. Detailed flowchart of the current frontend interface request: 1. Client request → 2. Ingress Controller (ingress-nginx-controller) → 3. Frontend Service (frontend-svc-80) → 4. Backend Service (backend-svc-80) → Timeout (504|499) → 5. Frontend Service returns 404 → 6. Ingress Controller returns 404
8. After applying the adjustment from step 5, when the backend interface response times out, it no longer returns a 404, which meets expectations. See Figure 6.

