Servers

Nginx returns 502 only for long-running API requests

Environment

Environment

Nginx reverse proxy in front of a Node.js reporting service.

What happens

What happens

Short requests succeed, while reports taking over sixty seconds end with 502.

What I have tried

What I have tried

Raised the client body limit and restarted both services.

I would appreciate advice on how to identify the root cause without risking existing data or configuration.

COMMUNITY RESPONSES

Verified community troubleshooting

0 replies

No answers yet..

Showing 0 of 0 community responses
AI DIAGNOSTICS

Incident analysis

Updated 3w ago• Trouble ID

Most likely causes

The upstream closes or exceeds proxy read timeout before returning the report. 79%
A recent software, firmware or configuration change is exposing an existing compatibility issue. 31%

Summary

The reported behaviour is consistent with the upstream closes or exceeds proxy read timeout before returning the report. The safest next step is to verify that hypothesis with a reversible test before making permanent configuration changes.

Suggested Fixes

Verify the likely cause
Check upstream logs, align proxy timeouts and redesign long jobs to return an identifier that can be polled asynchronously.
Validate and monitor
Reproduce the issue once after the change, review relevant logs or metrics, and keep a rollback path until the system has remained stable.

Continue troubleshooting

Matched from the title, description and tags