[38;5;215m[1m@[0m[1mhttp[0m [2m· HTTP status codes, explained[0m [38;5;203m[1mHTTP/1.1 504 Gateway Timeout[0m [38;5;203m━━━━━━━━━━━━━━━━━━━━━━━━━━━━[0m [2m5xx · Server error[0m A proxy timed out waiting for upstream. [38;5;203m[1mWHAT IT MEANS[0m [2m────────────────────────────────────────────────────────────[0m A gateway or proxy didn't get a response from the upstream server in time. Compared with 502: the upstream didn't answer badly, it didn't answer at all before the proxy gave up. [38;5;203m[1mWHY YOU'RE SEEING IT[0m [2m─────────────────────────────────────────────────────[0m [38;5;203m→[0m Slow database queries or long reports. [38;5;203m→[0m An upstream that's overloaded or stuck. [38;5;203m→[0m Proxy timeouts set lower than the app's real response time, such as nginx's 60-second proxy_read_timeout default. [38;5;203m→[0m Cloudflare uses its own code, 524, when your origin takes too long. [38;5;203m[1mHOW TO FIX IT[0m [2m────────────────────────────────────────────────────────────[0m [38;5;203m→[0m Find what's slow on the upstream and optimise it. [38;5;203m→[0m Move long work to a background job and return 202. [38;5;203m→[0m Only raise proxy timeouts if the slow request is expected. [38;5;203m[1mEXAMPLE RESPONSE[0m [2m─────────────────────────────────────────────────────────[0m [38;5;203mHTTP/1.1 504 Gateway Timeout[0m [2mContent-Type: text/html[0m [2m[0m [2m