Skip to content
MtrXTools

upstream timed out (110: Connection timed out) while reading response header from upstream

The backend took too long to respond

Seen in nginx error log (shown to visitors as 504 Gateway Timeout)

nginx connected to the backend but did not receive response headers within proxy_read_timeout (60 seconds by default).

Common causes

  • A slow request in the application: long database queries, external API calls or heavy reports.
  • The backend is overloaded or all its workers are busy.
  • The backend is stuck or deadlocked and accepts connections without answering.

How to fix it

  1. Find and fix the slow request using the request and upstream fields in the log line.
  2. If long requests are expected, raise the timeout for that location: proxy_read_timeout 300s; (fastcgi_read_timeout for PHP-FPM).
  3. Add backend capacity (more workers or instances), or move long jobs to a background queue.

Got a different message? Paste it into the error explainer.

Related errors

All 19 Web servers & certificates errors