If you use a proxy server for your internet activity, and you are unable to fix a 504 error by refreshing the page or restarting the browser, you should check your browsers settings. The configuration could be defective and you should try to select a different proxy to work on.
In addition to setting up a proxy server, it is also possible to use vpns, which is the same concept of setting a proxy server but managed by someone else. Keep in mind that free VPNs almost always sell your information to third parties.
It might be possible 1) to also make use of a proxy server, configuring it appropriately in your operating system or in your browser. There are also some free public proxy servers, which are rather slow. Another potential solution is 2) to use one of the so-called DNS redirectors. Be also aware of possible resulting breaches of the respective law :)