Network connection If there are problems in the connectivity between the proxy server as well as web server, it could result in delays. There could also be issues with the network connection of the load balancer, in case it is being used.https://www.wpoven.com/blog/how-to-fix-504-gateway-timeout/