502 bad gateway errors, explained for PMs
Websites experiencing a 502 Bad Gateway error can be a nightmare, you’re losing a lot of traffic and you might not know why.
You don’t have to be stuck or stare at that almost white page. One thing you should as a PM is that there’s something wrong with the website’s server connection. There are things you can do to fix the error.
What is 502 bad gateway error
The hypertext transfer protocol (HTTP) — a set of rules that regulate the web — have given numbers to every problem. The 502 status code indicates:
- You’re working with a gateway or a proxy server. It is an intermediary or a mediator server that sits between two servers — your smartphone (or PC) and internet. As a mediator, it forwards requests from clients to servers and servers to clients.
- The proxy server tried to work with the origin server.
- “Tried” because it got some invalid response from the server and it showed you the error.
So the page won’t load because your proxy server didn’t the expected response from the server.
Impact of 502 bad gateway errors
As a PM, you can’t just not do anything since it has far reaching impacts, some of the important ones being:
- It can decrease the website traffic since your users cannot access desired content anymore.
- Users may perceive your website as unreliable, damaging their trust in your brand if it’s not fixed quickly.
- This can also negatively impact your search engine rankings, leading to a further decrease in organic traffic.
- If your website is an e-commerce platform or relies on advertising revenue, 502 errors can directly impact revenue generation.
Why do 502 bad gateway errors occur?
- 502 bad gateway errors occur when your smartphone is having trouble translating the domain names into numeric IP addresses. This is a general process they carry out. But if there’s an issue with this process it can trigger a bad gateway warning. One example of this could be, when you’re moving a website from one web hosting provider to another. When you do this, you often need to update the DNS records for your domain, so they can point to the new hosting provider’s server. But it can take some time and during that time, users might still be getting directed to the servers of the old hosting provider, which is causing the error.
- Sometimes the reason could be as simple as too many visitors overwhelming the server. this can often make the requests impossible to resolve.
- Sometimes the reason could be problems in firewall setup, which is blocking proxy’s communication with the server. Firewall is a network security device that monitors and controls the network traffic — based on some rules. So firewalls are like the security you place at your front door to control who can and cannot enter your home. Firewalls are security for your computer network — it separates your trusted internal network, such as your home network, from untrusted ones, like internet. Based on some rules, it allows only the authorized traffic to pass through and blocks unauthorized access attempts. So if the firewall’s rules are overtly restrictive or if there are misconfigurations preventing the proxy server from establishing a connection with the server, you might face 502 Bad Gateway error.
- You might be facing this error if your server is down for maintenance.
Depending on which type of error you’re facing, there are solutions.
Solving 502 bad gateway errors
Check the server logs on both the client side and the server side for any error messages or indications of what might be causing the error.
- Are you dealing with a DNS problem? If yes, you might want to reach out to the DNS service provider or see if there are typos in the DNS settings.
- You might want to use network diagnostic tools to check the reachability and connectivity of the server from your location. For example, you could run a ping test to see if messages are reaching your IP.
- If the issue is with firewalls, you could try scaling them back to ensure all traffic flows easily. But this could have major security risks.
- If your server is down for maintenance, all you can do is wait.
What can your users do?
- Ask them to reload the website, sometimes it may solve the problem.
- Ask them to clear the browser cache and try again.