The 504 (Gateway Timeout) status code indicates that the server, while acting as a gateway or proxy, did not receive a timely response from an upstream server it needed to access in order to complete the request. The error may be a temporary occurrence due to too much traffic toward the server or site.
Solution
If you try and query the sites endpoint and it returns an empty array then it may mean that the on premises API setup has been lost and you may need to uninstall and re-install the Azure Proxy Tunnel.
