当您在访问某些网站时遇到问题时,您的浏览器通常会显示一个HTTP 状态代码(HTTP status code),以帮助您破译问题。这些代码有不同的类型和变体,每种代码都有其独特的含义和解决方案。您在上网时至少遇到一次 504 Gateway Timeout错误的可能性为 90%。(Gateway Timeout)
504网关超时(Gateway Timeout)是什么意思?504 Gateway Timeout错误被多个网站和浏览器标记为不同的标签,但这些变化意味着同一件事。因此,如果某个特定网站抛出“网关超时(Gateway Timeout)(504)”错误,而其他网站则显示为“HTTP 错误 504”、“域响应时间过长”或“网关超时(Gateway Timeout)”,他们指出了同样的问题。
在本指南中,我们将引导您了解有关 504网关超时(Gateway Timeout)错误的所有信息——含义、原因和解决方案。
504网关超时错误是什么意思(Gateway Timeout Error Mean)?
当您访问网站或单击浏览器上的链接时,幕后会发生很多事情。通常,它遵循以下步骤:
- 在浏览器的地址栏中输入URL。
- 浏览器验证并定位网站的 IP 地址(通过DNS 查找(DNS lookup))。
- 浏览器向网站的服务器发送请求。
- 服务器处理请求并将网页的副本发送到浏览器。
- 浏览器组装和解释来自服务器的信息并显示网页。
如果您的浏览器显示 504 Gateway Timeout错误而不是功能网页,则表明Step 4存在问题。也就是说,网站的服务器未能足够快地处理浏览器的请求。
当网站的网关服务器(或主服务器)没有收到来自辅助服务器(也称为上游服务器)的及时响应时,就会发生这种情况。那么,究竟是什么原因导致服务器连接延迟呢?继续下一部分以找出答案。
什么原因导致 504网关超时错误(Gateway Timeout Error)?
通常,由于网站端的服务器连接问题,会出现504 Gateway Timeout错误;(Gateway Timeout)也许,一个(或所有)服务器崩溃或暂时超载并且无法处理新请求。如果网站最近移动到新的 IP 地址(托管服务)或其防火墙配置错误地阻止了安全内容,也可能发生此错误。
服务器端故障通常是 504网关超时(Gateway Timeout)错误的原因,因此网站管理员处于解决问题的最佳位置。尽管如此,您还应该对设备进行故障排除。这是因为 504超时(Timeout)错误也可能源于您的设备或网络设置问题——尽管这种可能性非常罕见。
如何修复 504网关超时错误(Gateway Timeout Error)
我们编制了一些潜在的故障排除方法,如果问题出在您的端,这些方法将解决错误。让它们进行测试,看看它们是否适合您。
1.刷新网页
如前所述,如果网站的服务器超载(可能是由于流量突然激增),网站可能会显示 504 错误代码。如果这是错误的原因,重新加载网页可能会使事情恢复正常。单击(Click)地址栏旁边的圆形箭头图标或按 F5 重新加载页面。
您还可以使用Control + R快捷方式(适用于 Windows)或Command + R(适用于 Mac)在任何浏览器上重新加载页面。
2.重新启动您的路由器(Router)或网络设备(Network Device)
在重新启动网络设备之前,请将您的计算机连接到备用网络(如果有任何可用网络)。如果您可以在不同的网络上访问该网页,那么您的无线路由器或互联网调制解调器就是问题所在。
重新启动(Restart)网络设备,将您的计算机重新连接到网络,然后重新加载网页。如果您仍然收到 504网关超时(Gateway Timeout)错误,请考虑将路由器(resetting the router)或调制解调器重置为出厂默认设置。
3.检查您的代理设置
如果您在计算机上使用代理,请确保服务器设置正确且配置正确。转到设置(Settings )>网络和 Internet( Network & Internet ) >代理( Proxy)(适用于 Windows)或系统偏好设置(System Preferences )>网络( Network )>高级( Advanced )>代理( Proxies)(适用于 macOS)以检查是否有任何手动代理设置。
禁用代理并刷新受影响的网站。如果您的浏览器加载网页,则您的代理配置可能是问题所在。
4.更改DNS服务器
大多数计算机使用Internet 服务提供商(Internet Service Provider)( ISP )指定的默认域名服务器(Domain Name Servers)( DNS )。这些ISP分配的服务器有时不可靠,并会导致连接缓慢等问题。如果受影响的网页在其他设备上成功加载,请将您 PC 的DNS提供商更改为任何免费且可靠(free and reliable public server)且响应时间快的公共服务器。这可以带来很大的不同。
在 Windows 上更改 DNS(Change DNS on Windows)
要更改 Windows 上的 DNS 提供商(change your DNS provider on Windows),请转到设置(Settings)>网络和 Internet( Network & Internet) >状态( Status),然后单击更改适配器选项(Change adapter options)。
2. 在下一个窗口中,双击负责您的网络连接的适配器:以太网(Ethernet)或Wi-Fi。
3. 单击属性(Properties)按钮。
4. 在“此连接使用以下项目”部分,双击Internet Protocol Version 4 (TCP/IPv4)。
5. 勾选“使用以下 DNS 服务器地址(Use the following DNS server addresses,)” ,在首选 DNS(Preferred DNS)服务器框中输入8.8.8.8 ,在备用 DNS服务器框中输入(Alternate DNS)8.8.4.4。单击“(Click)确定(OK)”继续。
6. 最后,单击Wi-Fi/Ethernet Properties窗口上的确定(OK)以保存更改。
在 macOS 上更改 DNS(Change DNS on macOS)
对于 Mac 用户,导航到系统偏好设置(System Preferences )>网络( Network),然后单击左下角的高级(Advanced)按钮。
转到DNS选项卡,然后单击按钮左角的plus (+)DNS服务器。
添加这些 Google 公共 DNS:8.8.8.8和8.8.4.4。单击“确定(OK)”继续,然后单击下一页上的“应用”以保存更改。(Apply)
5.清除DNS缓存
当您访问网站时,您的计算机会将有关网站域名的信息存储在DNS缓存中。下次您访问该网站时,DNS缓存中的数据会迅速将您的浏览器指向正确的方向,以便网站加载更快。
如果网站更改其 IP 地址或服务器,则可能会遇到超时错误。这是因为DNS缓存会将您的浏览器定向到旧的(或过时的)IP 地址。您可以通过清除 DNS 缓存(clearing the DNS cache)来解决此问题。这将提示您的设备和浏览器在您下次访问该网站时获取更新的DNS信息。(DNS)
要清除Mac上的(Mac)DNS缓存,请启动终端(Terminal)(转到Applications > Utilities > Terminal),将以下命令粘贴到控制台中,然后按Return。
sudo dscacheutil -flushcache;sudo killall -HUP mDNSResponder
出现提示时输入您的 Mac 密码,然后按Return。
对于Windows设备,启动命令(Command)提示符(按Windows + X并选择Command Prompt (Admin)),将下面的命令粘贴到控制台中,然后按Enter。
ipconfig /flushdns
享受无错误的互联网(Internet)体验
希望您现在知道导致 504 超时错误的原因以及作为网站访问者如何尝试修复它。如果对您的计算机和网络设置进行故障排除后错误仍然存在,请联系网站管理员;问题肯定是由于服务器端故障造成的。如果每个其他网站都弹出错误,您应该联系您的ISP以确认是否存在网络中断。
What Does 504 Gateway Timeout Mean and How to Fix It
When you run into trouble accessing certаin websites, your browser often displays аn HTTP status code that helps you decipher the problem. These codes come in different types and variations, each with its individual meaning and solutions. There’s a 90% chance that you’ve encountered a 504 Gateway Timeout error at least once while surfing the internet.
What does 504 Gateway Timeout mean? The 504 Gateway Timeout error is labeled differently by several websites and browsers but the variations mean the same thing. So if a particular website throws a “Gateway Timeout (504)” error while others display theirs as “HTTP Error 504,” “Domain took too long to respond,” or “Gateway Timeout,” they’re pointing out the same issue.
In this guide, we’ll walk you through everything you need to know about the 504 Gateway Timeout error—meaning, causes, and the solutions.
What Does the 504 Gateway Timeout Error Mean?
There’s a lot that happens behind the scene when you visit a website or click a link on your browser. Typically, it follows the steps below:
- Enter a URL in the browser’s address bar.
- The browser validates and locates the website’s IP address (via DNS lookup).
- The browser sends a request to the website’s servers.
- The servers process the request and send a copy of the web page to the browser.
- The browser assembles and interprets the information from the server and displays a webpage.
If your browser displays the 504 Gateway Timeout error instead of a functional webpage, that tells you there was a problem with Step 4. That is, the website’s servers failed to process your browser’s request fast enough.
This occurs when a website’s gateway server (or primary server) doesn’t receive a timely response from a secondary server (also called an upstream server). So, what exactly causes this delay in server connection? Proceed to the next section to find out.
What Causes the 504 Gateway Timeout Error?
Oftentimes, the 504 Gateway Timeout error arises due to server connectivity issues on the website’s end; perhaps, one (or all) of the servers crashed or is temporarily overloaded and can’t process new requests. This error may also occur if the website recently moved to a new IP address (hosting service) or its firewall configuration is erroneously blocking safe content.
Server-side malfunctions are commonly responsible for the 504 Gateway Timeout error, so a website’s administrator is in the best position to resolve the problem. Nonetheless, you should also troubleshoot your device. This is because the 504 Timeout error could also stem from issues with your device or network settings—although the possibility is quite rare.
How to Fix the 504 Gateway Timeout Error
We’ve compiled a handful of potential troubleshooting methods that’ll resolve the error if the problem is from your end. Put them to test and see if they work for you.
1. Refresh the Webpage
As earlier mentioned, a website may display the 504 error code if its servers are overloaded—perhaps due to a sudden spike in traffic. If this is the cause of the error, reloading the webpage may restore things back to normalcy. Click the circular arrow icon next to the address bar or press F5 to reload the page.
You can also reload a page on any browser using the Control + R shortcut (for Windows) or Command + R (for Mac).
2. Restart Your Router or Network Device
Before you reboot your network device, connect your computer to an alternate network if there’s any available. If you can access the webpage on a different network, your wireless router or internet modem is the problem.
Restart the network device, reconnect your computer to the network, and reload the webpage. If you’re still getting the 504 Gateway Timeout error, consider resetting the router or modem to factory default.
3. Check Your Proxy Settings
If you use a proxy on your computer, make sure the server settings are correct and properly configured. Go to Settings > Network & Internet > Proxy (for Windows) or System Preferences > Network > Advanced > Proxies (for macOS) to check for any manual proxy setup.
Disable the proxy and refresh the affected website. If your browser loads the webpage, your proxy configuration is probably the problem.
4. Change DNS Servers
Most computers use the default Domain Name Servers (DNS) designated by the Internet Service Provider (ISP). These ISP-assigned servers are sometimes unreliable and cause issues like slow connectivity. If the affected webpage loads successfully on a different device, change your PC’s DNS provider to any free and reliable public server with fast response time. That can make a lot of difference.
Change DNS on Windows
To change your DNS provider on Windows, go to Settings > Network & Internet > Status and click Change adapter options.
2. On the next window, double-click on the adapter responsible for your network connection: Ethernet or Wi-Fi.
3. Click the Properties button.
4. In the “This connection uses the following items” section, double-click Internet Protocol Version 4 (TCP/IPv4).
5. Check the “Use the following DNS server addresses,” enter 8.8.8.8 in the Preferred DNS server box and 8.8.4.4 in the Alternate DNS server box. Click OK to proceed.
6. Finally, click OK on the Wi-Fi/Ethernet Properties window to save the changes.
Change DNS on macOS
For Mac users, navigate to System Preferences > Network and click the Advanced button at the bottom-left corner.
Go to the DNS tab and click the plus (+) icon at the button-left corner to add a new DNS server.
Add these Google Public DNS: 8.8.8.8 and 8.8.4.4. Click OK to proceed and click Apply on the next page to save the changes.
5. Clear the DNS Cache
When you visit a website, your computer stores information about the website’s domain name in a DNS cache. Next time you visit the website, data in the DNS cache swiftly points your browser in the right direction so that the website loads faster.
It’s possible to experience a timeout error if a website changes its IP address or server. This is because the DNS cache will direct your browser to the old (or outdated) IP address. You can fix this problem by clearing the DNS cache. That will prompt your device and browser to obtain updated DNS information next time you visit the website.
To clear the DNS cache on Mac, launch Terminal (go to Applications > Utilities > Terminal), paste the command below in the console, and press Return.
sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder
Enter your Mac’s password when prompted and press Return.
For Windows devices, launch the Command prompt (press Windows + X and select Command Prompt (Admin)), paste the command below in the console, and press Enter.
ipconfig /flushdns
Enjoy an Error-Free Internet Experience
Hopefully, you now know what causes the 504 timeout error and how you can attempt to fix it as a website visitor. If the error continues after troubleshooting your computer and network settings, reach out to the website administrator; the problem is most definitely due to server-side malfunctions. If the error is popping up on every other website, you should contact your ISP to confirm if there’s a network outage.