What is error 502 and how to fix it
Miscellaneous / / July 31, 2021
Instructions for users and site administrators.
What the 502 error means
Error 502 Bad Gateway indicates that the server that your computer or smartphone tried to connect to received an incorrect response from the server at a higher level. Most often this happens due to problems in the operation of DNS, proxy or hosting.
In the Telegram channel “Life hacker»Only the best writing about technology, relationships, sports, cinema and more. Subscribe!
In our Pinterest only the best texts about relationships, sports, cinema, health and much more. Subscribe!
How to fix error 502
Go from simple to complex - and at some point the error may disappear.
Check your internet connection
Try to go to other pages or see if messages are coming in messengers. If nothing is available, then it’s not the site settings, but your Internet connection.
See if everyone is showing error 502
Visit the site from another computer or smartphone. If the error is not displayed there, then the matter is in the settings of your device - read on for how to fix it.
If you don't have another gadget at hand, you can use online services. They will show if the site is available to other users:
- Down for Everyone or Just Me;
- Is It Down Right Now;
- Reg.ru;
- 2IP.
Refresh the page
Sometimes developers set a certain limit on the number of requests to the site for a specific period of time - a minute or a second. If you are trying to visit a popular page and see a 502 error, then perhaps too many users are doing the same.
If this is the cause of the error, a simple page refresh will help. You can click the round arrow button in your browser or F5 on your keyboard.
Try a different browser
If you see error 502 only on one device, it may be a matter of the settings of a particular program. Open the site in a different browser: sometimes this solves the problem.
Disable plugins and extensions in your browser
Often, browser plugins and extensions, especially for working with proxy and VPN services, block access to individual sites, and error 502 occurs. Try to disable them and visit the page again. If you are running proxy applications or VPN, close them too.
Clear your browser cache
Your browser's cache may contain incorrect data, which is causing you to receive a 502 error when you try to open the site. Clearing the cache may resolve the issue.
Here's how to do it in Chrome.
- In the settings, go to the "Privacy and security" section and select "Clear history".
- Check the boxes next to the second and third items: "Cookies and other site data", "Images and other files stored in the cache."
- Then click "Delete Data".
For instructions for other browsers, see here.
Clear the DNS cache
On Windows 10
- To bring up the console, type cmd in the start menu search box.
- In the window that opens, enter the command ipconfig / flushdns and press Enter.
On Windows 7
- In the console, enter the command ipconfig / flushdns and press Enter.
- Then run the commands in the same place net stop dnscache and net start dnscache, to restart the DNS Client service.
On macOS
- Click on the search icon in the upper right corner and write "Terminal".
- In the terminal window that opens, enter the command sudo killall -HUP mDNSResponder; sleep 2;.
On Linux
- Launch the terminal by pressing Ctrl + Alt + T or from the main menu.
- In the window that opens, enter the command sudo service network ‑ manager restart and press Enter. This works for sure on Ubuntu and sometimes other distributions. Alternative - commands sudo systemd ‑ resolve —flush ‑ caches or sudo /etc/init.d/nscd restart.
Certain distributions may require running other commands and services.
Reboot your router
Go to the router's management console and find the corresponding item. Or, turn off the power to the device for 10-15 seconds and then reconnect it to the mains.
Change the default DNS server
Specify the addresses of public DNS servers in the router settings. For example, you can write IPv4 for Google Public DNS: 8.8.8.8 or 8.8.4.4. Or, if your server supports IPv6, set the addresses 2001: 4860: 4860:: 8888 and / or 2001: 4860: 4860:: 8844.
Come back later
There may be nothing you can do about it - especially if you are not the only one with the 502 error. In such a situation, the only way out is to try to visit the site later.
Tell the administrator
If you have contacts of the site administrator, tell him about error 502. Perhaps he is not yet aware of the problem and, accordingly, does not yet solve it.
How can an administrator fix error 502
If the 502 error appears while loading your site, try these steps one by one until the problem goes away.
Check the error log
You can find a lot of useful and interesting information in the logs. Determine the moment when the 502 error message first appeared and analyze the events that preceded it. This often helps to understand what happened and how to fix it.
Disable or remove fresh plugins and components
Sometimes the installation of new components and plugins on the site leads to conflicts. As a result, the resource does not work as it should, and users see a 502 error in their browsers.
If you've recently updated your site, try uninstalling the newly installed components. Proceed step by step and after each change check if the error has disappeared.
Try disabling anti-DDoS
Often hosting offer ready-made tools that prevent DDoS attacks on the site. Such solutions redirect traffic from visitors to dedicated servers. There, DDoS requests are separated from real ones, the traffic is cleaned, optimized and transmitted to your resource.
But if something goes wrong in this chain, a 502 error occurs. Try to temporarily disable anti-DDoS - sometimes the problem disappears after that.
Increase the amount of resources
The reason for the 502 error may be a lack of hosting capacity that hosts your site. This is especially true for virtual servers.
If during the operation of the site you go beyond the limits of the tariff plan, the hosting terminates the connection. Usually information about this can be found in the logs. In this case, you need to rent a server with a large number of processors and RAM.
Ask for help
Look for a solution to the problem in your hoster's FAQ or at Stack Overflow. Chances are that you are not the first to face this situation, and the recipe has already been described in detail.
If advice from the Internet does not work, create your own topic on the forum or ask more experienced colleagues for help. Perhaps they will suggest something sensible.
If this does not help, it may be worth seeking advice from a specialist - an employee of your hosting or an expert on your site's engine. They will analyze the problem comprehensively, find its cause and get rid of the 502 error.
Read also💿⚙️💻
- What to do if the browser slows down
- How to fix CPU Fan Error when booting your computer
- What to do if the DNS server is not responding
- What is error 500 and how to fix it
- What does 404 Not Found and other web page errors mean?
The authoritative scientific journal Nature wrote about the safety and effectiveness of "Sputnik V"
Scientists have shown a prototype of a protective mask that can test for coronavirus
What is coronavirus revaccination and why is it needed? Answered the main questions