PDF download Download Article
Everything you need to know about this HTTP code
PDF download Download Article

Are you encountering a 504 Gateway Timeout error when trying to visit a website? This is definitely a frustrating issue, especially if you're not sure what this error means or how to fix it (but it's likely not your fault!). In this article we'll go over what a 504 Gateway Timeout error is, how to fix it (for users and website owners), and some common error messages you may see instead of just "504 Gateway Timeout."

Ways to Fix a 504 Gateway Timeout Error

  • Refresh the page
  • Check your network settings (including proxies, firewall, and VPN)
  • Flush the DNS cache
  • Restart your router and/or modem
  • Restart your computer
  • Wait until the website owner fixes the issue
Section 1 of 4:

504 Gateway Timeout Meaning

PDF download Download Article
  1. When you go to a website, your browser sends a request to the website's server to load the webpage. If the website's server takes too long to reply to that request, you can get a 504 Gateway Timeout error. [1]
  2. There are many of these codes ranging from 1xx to 5xx. 5xx codes indicate a server-side problem, which means a 504 error is most likely not the fault of the website user.
    • Despite this, there are some fixes website users can try. You can read about them below . Website owners can check out some solutions in this article, too .
  3. Advertisement
Section 2 of 4:

Fixes for Website Users

PDF download Download Article
  1. The first thing to try is refreshing the page. The 504 error may be due to a random glitch, and refreshing the page can fix that error.
  2. If you use a proxy or a VPN , try temporarily disabling them. You may also want to check your firewall settings to ensure your settings aren't set too strictly.
    • On Windows, search for "proxy" or "firewall" in the taskbar search bar to pull up your proxy or firewall settings. You can also search for "network troubleshooter" to use the built-in troubleshooter to fix any network issues.
    • On Mac, open the Apple menu and go to System Settings > Network . Choose either Proxies or Firewall to edit these settings.
    • If you have a VPN, each VPN program will be set up slightly differently. Open your VPN program and look for an option or toggle to turn it off.
  3. If your network settings seem normal, you can try flushing your DNS cache . This can resolve some network connectivity issues and will remove old, bad, and corrupt data from your DNS cache.
    • Windows: Search "cmd" in the taskbar search bar, then right-click Command Prompt and select Run as administrator . Then, type ipconfig /flushdns and press Enter to flush your DNS.
    • Mac: Press Cmd + Space and search for the Terminal app, then open it. Type sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder . Press Return and enter your admin password.
  4. If you're getting 504 errors on every site, the problem may be with your network devices. Unplug your router and/or modem from the wall for at least 30 seconds, then plug it back in. Once your internet connection is restored, try accessing the site again.
    • Many people have combination routers and modems, so you'll only need to unplug one device.
  5. If restarting your router and/or modem doesn't fix the issue, you can try restarting your entire computer. While it may not seem like it, restarting your computer can fix a whole host of seemingly random issues, including network issues that cause problems accessing websites.
  6. If nothing else works, the issue is likely server-side and must be fixed by the website owner.
    • If you can access other web pages on the site or know the website's contact info, you can contact the site to report the error.
    • You can also check with your ISP to see if the issue is on their end.
  7. Advertisement
Section 3 of 4:

Fixes for Website Owners

PDF download Download Article
  1. If you recently transferred your website to a different server, your domain's DNS may not be propagated fully yet. Use https://dnschecker.org to see if your site's DNS is propagated.
    • You may want to also check your domain's DNS settings to ensure there are no errors.
  2. If you use a CDN like Cloudflare, you may want to try temporarily disabling it if you're encountering 504 errors on your site. The CDN could be causing the error by not giving a timely response to the origin server's request.
  3. If malicious bots are spamming your website, it can lead to all visitors getting a 504 error. Check your site's access logs to see if there's an influx of suspicious IPs visiting your site, then block them.
    • If you encounter a lot of DDoS attacks, consider using DDoS protection. Many cloud services, including Cloudflare, Amazon Web Services, and Microsoft Azure, offer DDoS protection.
  4. If you're using NGINX, you may be encountering 504 errors due to your API calls taking too long to complete. If this is the case, you can extend your API request timeout limit.
    • Go to /etc/nginx/sites-available/default or /etc/nginx/nginx.conf .
    • Add the following:
      • proxy_connect_timeout 240;
      • proxy_send_timeout 240;
      • proxy_read_timeout 240;
      • send_timeout 240;
    • Run sudo nginx -t to check syntax.
    • Run sudo service nginx restart . [2]
  5. Advertisement
Section 4 of 4:

Common 504 Error Messages

PDF download Download Article
  1. 504 error messages do not always have the same wording. However, the message should say "504" somewhere in the error. These are some of the common error messages you might see when you're encountering a 504 error:
    • 504 Gateway Timeout
    • 504 Gateway Timeout NGINX
    • Gateway Timeout Error
    • Gateway Timeout (504)
    • HTTP 504
    • HTTP Error 504 - Gateway Timeout
    • 504 Error


Expert Q&A

Ask a Question
      Advertisement

      Tips

      Submit a Tip
      All tip submissions are carefully reviewed before being published
      Name
      Please provide your name and last initial
      Thanks for submitting a tip for review!

      About This Article

      Thanks to all authors for creating a page that has been read 4,525 times.

      Is this article up to date?

      Advertisement