504 Gateway Timeout

HTTP 504 Gateway Timeout is a 5xx server error status. A proxy or gateway did not get a response from upstream in time.

504Status code
5xxServer error
NoCacheable by default
RFC 9110 §15.6.5Defined in

Common causes

What to do

Speed up the slow request, move it to a background job, or raise the proxy timeout.

Example response

HTTP/1.1 504 Gateway Timeout
Content-Type: application/problem+json

{"status":504,"title":"Gateway Timeout"}

Returning 504 in code

Express   res.status(504).json({ … });
Flask     return jsonify(…), 504
PHP       http_response_code(504);
Go        w.WriteHeader(504)
nginx     return 504;

Other 5xx codes

Frequently asked questions

What does HTTP 504 mean?
A proxy or gateway did not get a response from upstream in time.
Is 504 an error?
Yes. It is a server error: the request may be fine and the problem lies on the server or an upstream service.
Does a 504 hurt SEO?
If search engines see it repeatedly on pages that should rank, those pages can be dropped from the index. Fix it quickly.