发生此错误的原因是充当网关或代理的服务器尝试(server acting)访问(gateway or proxy)主服务器以完成请求,但收到无效或根本没有响应。有时(Sometimes),由于连接断开或服务器端问题导致的空或不完整的标头在通过网关或代理访问时会导致(gateway or proxy)错误 502 (Error 502) Bad Gateway。
根据RFC 7231,502(RFC 7231) Bad Gateway(Bad Gateway)是一个HTTP 状态(HTTP status)码,定义为
502 (Bad Gateway) 状态代码(status code)表示服务器在充当网关或代理(gateway or proxy)时,在尝试满足请求时从它访问的入站服务器(inbound server)接收到无效响应。
您可能会看到不同(Different)类型的 502 Bad Gateway 错误(Bad Gateway error):
- 502错误的网关
- HTTP 错误 502 – 网关错误
- 502 服务暂时超载
- 错误 502
- 502 代理错误
- HTTP 502
- 502 网关错误 NGINX
- Twitter 容量过剩(Twitter overcapacity)实际上是一个 502 Bad Gateway 错误(Bad Gateway error)
- 由于 502 错误显示Windows更新失败 WU_E_PT_HTTP_STATUS_BAD_GATEWAY(Update)
- Google显示服务器错误(Server error)或仅显示 502
您无法控制 502 错误,因为它们是服务器端的,但有时您的浏览器会被欺骗显示它,因此您可能会尝试解决问题的故障排除步骤很少。
如何修复 502 Bad Gateway 错误
确保(Make)创建一个还原点(restore point) 以防万一(case something)出现问题。
方法一:重新加载网页(Method 1: Reload the Web Page)
如果您因为502 Bad Gateway Error而无法访问特定网页(web page),请等待几分钟,然后再次尝试访问该网站。等待一分钟左右后简单的重新加载可以毫无问题地解决此问题。Use Ctrl + F5重新加载网页,因为它绕过缓存并再次检查问题是否已解决。
如果上述步骤没有(step didn)帮助,关闭您正在处理的所有内容并重新启动浏览器可能是个好主意。然后再次向您提供 502 Bad Gateway Error的同一个网站,看看您是否能够修复该错误,然后继续下一个方法。
方法二:换个浏览器试试(Method 2: Try another browser)
您当前的浏览器可能存在一些问题,因此最好尝试使用其他浏览器再次访问同一网页(web page)。如果问题得到解决,您必须重新安装浏览器才能永久解决错误,但如果您仍然面临 502 Bad Gateway Error,那么这不是与浏览器相关的问题。
方法三:清除浏览器缓存(Method 3: Clear Browser’s Cache)
如果以上方法都不起作用,那么我们建议您尝试使用其他浏览器来查看Fix 502 Bad Gateway Error是否仅适用于Chrome。如果是,那么您应该尝试清除Chrome 浏览器(Chrome browser)中所有已保存的浏览数据。现在按照给定的步骤清除您的浏览数据:
1. 首先,点击浏览器窗口(browser window)右上角(right corner)的三个点(three dots),然后选择设置( select Settings)。您还可以在 URL 栏中键入chrome://settings 。
2. 当设置选项卡(Settings tab)打开时,滚动到底部并展开高级设置( Advanced Settings)部分。
3. 在高级部分(Advanced section)下,找到隐私和安全部分下的清除浏览数据选项。(Clear browsing data)
4. 点击清除浏览数据(Clear browsing data)选项并在时间范围(Time range)下拉菜单中选择“所有时间”。(All time)选中所有框,然后单击清除数据(Clear Data) 按钮。
清除浏览数据后,关闭并重新启动Chrome 浏览器(Chrome browser),查看错误是否消失。
方法 4:以安全模式启动浏览器(Method 4: Start your Browser in Safe Mode)
Windows 安全模式(Windows Safe Mode)是另一回事,不要(thing don)混淆它(t confuse),也不要在安全模式下启动 Windows。
1.在桌面创建一个Chrome图标的快捷方式,(shortcut of Chrome icon)然后右键选择属性(properties)。
2. 选择目标字段( Target field)并 在命令末尾键入–incognito 。
3.单击确定(Click OK),然后尝试使用此快捷方式打开浏览器。(Browser)
4.现在尝试访问该网站,看看是否可以修复 502 Bad Gateway Error。
方法 5:禁用不必要的扩展(Method 5: Disable Unnecessary Extensions)
如果您能够通过上述方法解决问题,那么您需要禁用不必要的扩展来永久解决问题。
1. 打开Chrome,然后导航到设置。(Settings.)
2. 接下来,从左侧菜单中选择扩展。(Extension)
3.确保禁用并删除(disable and delete)所有不必要的扩展。
4.重新启动浏览器(Browser),错误可能已经消失。
方法 6:禁用代理(Method 6: Disable Proxy)
使用(Use)代理服务器是Fix 502 Bad Gateway Error的最常见原因。如果您使用的是代理服务器(proxy server),那么这种方法肯定会对您有所帮助。您需要做的就是禁用代理设置。您可以通过取消选中计算机Internet属性(Properties)部分下LAN设置中的几个框来轻松完成此操作。如果您不知道如何操作,请按照给定的步骤操作:
1.首先,同时按Windows Key + R运行(RUN) 对话框 。
2. 在输入区输入inetcpl.cpl并点击(inetcpl.cpl)OK。
3. 您的屏幕现在将显示Internet 属性( Internet Properties )窗口。切换到Connections选项卡并单击LAN settings。
4.将弹出一个新的LAN设置窗口。(LAN)在这里,如果您取消选中为 LAN 使用代理服务器(Use a proxy server for your LAN)选项会很有帮助。
5.另外,请确保选中自动检测设置(Automatically detect settings)。完成后,单击“确定”按钮(OK button)。
重新启动计算机以应用更改。启动 Chrome 并检查 Fix 502 Bad Gateway Error 是否消失。它还有助于修复 Chrome 403 错误。它还有助于修复 Chrome 403 错误。(Launch Chrome and check if the Fix 502 Bad Gateway Error is gone. It would also help fix Chrome 403 error.. It would also help fix Chrome 403 error..)我们确信这种方法会奏效,但如果没有,请继续尝试我们在下面提到的下一个方法。
方法 7:更改 DNS 设置(Method 7: Change DNS Settings)
这里的重点是,您需要将DNS设置为自动检测IP 地址(IP address)或设置您的ISP提供的(ISP)自定义地址(custom address)。当没有设置任何设置时,会出现修复 502 Bad Gateway 错误。(Fix 502 Bad Gateway Error)在这种方法中,您需要将您计算机的DNS 地址(DNS address)设置为Google DNS 服务器(Google DNS server)。请按照给定的步骤执行此操作:
1. 右键单击任务栏面板(taskbar panel)右侧的网络图标(Network icon)。现在单击打开(Open)网络和共享中心(Network & Sharing Center) 选项。
2. 当网络和共享中心(Network and Sharing Center )窗口打开时,在此处单击当前连接的网络。( click on the currently connected network here.)
3. 点击已连接网络(connected network),会弹出WiFi状态窗口。(WiFi status)单击(Click)属性(Properties )按钮。
4.弹出属性窗口(property window)时, 在 Networking 部分搜索Internet Protocol Version 4 (TCP/IPv4)双击它。
5. 现在新窗口将显示您的DNS设置为自动输入还是手动输入。在这里,您必须单击使用以下 DNS 服务器地址(Use the following DNS server addresses)选项。并在输入部分(input section)填写给定的DNS 地址(DNS address):
8.8.8.8
8.8.4.4
6. 选中退出时验证设置(Validate settings upon exit) 框,然后单击确定。
现在关闭所有窗口并启动Chrome以检查您是否能够修复 502 Bad Gateway 错误。( Fix 502 Bad Gateway Error.)
Method 8: Flush DNS and Reset TCP/IP
1.右键单击Windows按钮(Windows Button)并选择“命令提示符(管理员(Admin))。”
2. 现在输入以下命令并在每个命令后按 Enter :(command and press Enter)
ipconfig /release
ipconfig /flushdns
ipconfig /renew
3.再次(Again),打开Admin Command Prompt并键入以下内容,然后在每个之后按回车:
ipconfig /flushdns
nbtstat –r
netsh int ip reset
netsh winsock reset
4. 重新启动以应用更改。刷新DNS似乎可以修复 502 Bad Gateway Error。(Fix 502 Bad Gateway Error.)
推荐的;(Recommended;)
- (Fix Error Code 0x8007000D)尝试激活 Windows 时修复错误代码 0x8007000D
- 如何修复应用程序错误 523
- 修复我们无法更新系统保留分区
- 修复 应用程序无法正确初始化
至此,您已成功修复 502 Bad Gateway Error,但如果您对本文仍有任何疑问,请随时在评论部分提出。
How to fix 502 Bad Gateway Error
This error oсcurs because the servеr acting as gateway or proxy tried to аccess the main ѕerver tо fulfil the request has received an invalid or no response at all. Sometimes empty or incomplete headers caused by broken connections or server-side іssues can cаuse Error 502 Bad Gateway when accessed via a gatewаy or proxy.
According to the RFC 7231, 502 Bad Gateway is an HTTP status code defined as
The 502 (Bad Gateway) status code indicates that the server, while acting as a gateway or proxy, received an invalid response from an inbound server it accessed while attempting to fulfil the request.
Different types of 502 Bad Gateway error you might see:
- 502 Bad Gateway
- HTTP Error 502 – Bad Gateway
- 502 Service Temporarily Overloaded
- Error 502
- 502 Proxy Error
- HTTP 502
- 502 Bad Gateway NGINX
- Twitter overcapacity is actually a 502 Bad Gateway error
- Windows Update fails due to 502 error displays WU_E_PT_HTTP_STATUS_BAD_GATEWAY
- Google displays Server error or just 502
You have no control over 502 error as they are server-side, but sometimes your browser is tricked into displaying it, so there are few troubleshooting steps you might try to fix the issue.
How to fix 502 Bad Gateway Error
Make sure to create a restore point just in case something goes wrong.
Method 1: Reload the Web Page
If you’re not able to visit a particular web page because of 502 Bad Gateway Error, then do wait for a few minutes before again trying to access the website. A simple reload after waiting for a minute or so can fix this issue without any problem. Use Ctrl + F5 to reload the web page as it bypasses the cache and again checks if the issue is resolved or not.
If the above step didn’t help, it might be a great idea to close everything you’re working on and restart your browser. Then again the same website which was giving you 502 Bad Gateway Error and see if you were able to fix the error if not then continue to the next method.
Method 2: Try another browser
It might be possible that there are some issues with your current browser, so it’s always a good idea to try another browser to visit the same web page again. If the issue is resolved, you have to re-install your browser to resolve the error permanently, but if you are still facing the 502 Bad Gateway Error, then it’s not a browser-related issue.
Method 3: Clear Browser’s Cache
If none of the above methods worked, then we suggest you try using other browsers to see if the Fix 502 Bad Gateway Error is exclusive to Chrome only. If it is, then you should try clearing all the saved browsing data of your Chrome browser. Now follow the given steps to clear your browsing data:
1. First, click on the three dots on the top right corner of the browser window and select Settings. You can also type chrome://settings in the URL bar.
2. When the Settings tab opens, scroll to the bottom and expand the Advanced Settings section.
3. Under the Advanced section, find the Clear browsing data option under Privacy and security section.
4. Click on the Clear browsing data option and select “All time” in the Time range dropdown. Check all the boxes and click on Clear Data button.
When the browsing data is cleared, close, and relaunch the Chrome browser and see if the error is gone.
Method 4: Start your Browser in Safe Mode
Windows Safe Mode is a different thing don’t confuse with it and don’t start your Windows in safe mode.
1. Make a shortcut of Chrome icon on the desktop and right-click then select properties.
2. Select the Target field and type –incognito at the end of the command.
3. Click OK and then try to open your Browser with this shortcut.
4. Now try to visit the website and see if you can fix 502 Bad Gateway Error.
Method 5: Disable Unnecessary Extensions
If you’re able to fix your issue via the above method, then you need to disable unnecessary extensions to resolve the issue permanently.
1. Open Chrome and then navigate to Settings.
2. Next, select Extension from the left-hand side menu.
3. Make sure to disable and delete all the unnecessary Extensions.
4. Restart your Browser, and the error may have gone away.
Method 6: Disable Proxy
Use of proxy servers is the most common cause of Fix 502 Bad Gateway Error. If you are using a proxy server, then this method is surely going to help you. All that you need to do is disable the proxy settings. You can do so easily by unchecking a few boxes in the LAN settings under your computer’s Internet Properties section. Just follow the given steps if you do not know how to do it:
1. First, open the RUN dialog box by pressing the Windows Key + R simultaneously.
2. Type inetcpl.cpl in the input area and click OK.
3. Your screen will now show the Internet Properties window. Switch to the Connections tab and click on LAN settings.
4. A new LAN settings window will pop up. Here, it would be helpful if you unchecked the Use a proxy server for your LAN option.
5. Also, make sure to checkmark Automatically detect settings. Once done, click on the OK button.
Restart your computer to apply the changes. Launch Chrome and check if the Fix 502 Bad Gateway Error is gone. It would also help fix Chrome 403 error.. It would also help fix Chrome 403 error.. We are sure that this method would have worked, but if it didn’t, move on and try the next method that we have mentioned below.
Method 7: Change DNS Settings
The point here is, you need to set the DNS to automatically detect IP address or set a custom address given by your ISP. Fix 502 Bad Gateway Error arises when neither of the settings has been set. In this method, you need to set your computer’s DNS address to the Google DNS server. Follow the given steps to do so:
1. Right-click the Network icon available on the right side of your taskbar panel. Now click on the Open Network & Sharing Center option.
2. When the Network and Sharing Center window opens, click on the currently connected network here.
3. When you click on the connected network, the WiFi status window will pop up. Click on the Properties button.
4. When the property window pops up, search for Internet Protocol Version 4 (TCP/IPv4) in the Networking section. Double click on it.
5. Now the new window will show if your DNS is set to automatic or manual input. Here you have to click on the Use the following DNS server addresses option. And fill the given DNS address on the input section:
8.8.8.8
8.8.4.4
6. Check the Validate settings upon exit box and click OK.
Now close all windows and launch Chrome to check if you’re able to Fix 502 Bad Gateway Error.
Method 8: Flush DNS and Reset TCP/IP
1. Right-click on Windows Button and select “Command Prompt(Admin).”
2. Now type the following command and press Enter after each one:
ipconfig /release
ipconfig /flushdns
ipconfig /renew
3. Again, open Admin Command Prompt and type the following and hit enter after each one:
ipconfig /flushdns
nbtstat –r
netsh int ip reset
netsh winsock reset
4. Reboot to apply changes. Flushing DNS seems to Fix 502 Bad Gateway Error.
Recommended;
That’s it you have successfully fixed 502 Bad Gateway Error, but if you still have any queries regarding this article, then please feel free to ask them in the comment’s section.