HTTP 504 status code means a proxy server (also known as gateway) didn’t receive the response from the upstream server (also known as origin server) in a timely manner.
Having a proxy server in front of the application (upstream) server is a common pattern in production web apps. Web servers (acting as reverse proxies) are more efficient in and capable of terminating TLS connections, dealing with slow clients, compressing requests, and serving static files quickly. Some popular open-source software used as proxies are Apache, Nginx, HAProxy, Varnish, and Caddy.
When proxying requests to the upstream server, make sure you send the following HTTP headers from the web server to the upstream:
X-Forwarded-For
X-Forwarded-Host
X-Forwarded-Port
X-Forwarded-Proto
X-Real-Ip
Apache
Try to increase the TimeOut
directive in your httpd.conf
file:
TimeOut 600
Also, match the max_execution_time
directive in your php.ini config file to the TimeOut
value you set in your httpd.conf
file:
max_execution_time=600
While you can increase a timeout on the web server, it is better to check the upstream server and make sure there are no surprises there.
No spyware, no promotional emails, or keyword-stuffed junk. I will only send you a single email when I've got something interesting to say. Unsubscribe anytime.
You can also subscribe to the Atom feed (it's like RSS, but better).