Whats your farm setup? do you using the DNS alias for site? is this error for everybody? any thing in the ULS log or Application log?
Http 504 error is basically "Gateway timeout error" and this due to networking error somewhere from the client side to the server.Check your default gateway or proxy server that is configured for the client it can
also be that DNS is acting up.
On the client machine run the following 4 commands in this order to clear up DNS and its caches...
ipconfig /flushdns
nbtstat -R
nbtstat -RR
arp -d *
alos check this one http://www.checkupdown.com/status/E504.html
Please remember to mark your question as answered &Vote helpful,if this solves/helps your problem. ****************************************************************************************** Thanks -WS MCITP(SharePoint 2010, 2013) Blog: http://wscheema.com/blog