Home › Knowledgebase › KB-1280

How to fix 502 bad gateway error on my website

Summary

This guide helps you troubleshoot and resolve: How to fix 502 bad gateway error on my website. Follow the steps below to fix the issue.

Quick Tip: Need immediate assistance? 💻 Open a Ticket

Common Causes

A 502 Bad Gateway error occurs when your web server acts as a gateway or proxy and receives an invalid response from an upstream server. For small business websites, this often points to server performance issues, resource bottlenecks, or temporary network connectivity problems between servers. This guide will help you diagnose whether the error is a momentary glitch or a sign that your current hosting environment is underpowered for your needs.

Remember — If you host with us, you don't need to do this yourself — just Open a Ticket and our Brisbane team will get it sorted.

Quick Fix Steps

  1. Refresh your browser page after waiting one to two minutes.
  2. Clear your browser cache and cookies, then reload the website.
  3. Try accessing your website from a different device or network to rule out local connectivity issues.
  4. Check your domain's DNS settings to ensure they are pointing to the correct server IP address.
  5. Restart your local router if you suspect a temporary network glitch.

Detailed Instructions

Check Server Resource Usage

If your website is hosted on a shared or underpowered plan, resource throttling can cause the upstream server to become unresponsive.

  1. Log in to your hosting control panel.
  2. Navigate to the resource usage or statistics section.
  3. Review CPU, memory, and entry process limits.
  4. Look for spikes that coincide with the times you encountered the 502 error.
  5. If resources are consistently maxed out, your site may have outgrown its current hosting plan.

Review Server Logs

Server error logs provide specific details about why the gateway is receiving invalid responses.

  1. Access the logs section in your hosting control panel.
  2. Open the error.log file for your domain.
  3. Search for entries marked 502 or upstream around the time of the error.
  4. Note any recurring timestamps or specific scripts causing the failure.

Inspect Proxy and Firewall Settings

Misconfigured proxy settings or overzealous firewall rules can block legitimate traffic between servers.

  1. Check your website's proxy configuration if you use a reverse proxy or CDN.
  2. Ensure your origin server IP is whitelisted in your firewall or security plugin.
  3. Temporarily disable any security plugins to test if they are blocking upstream requests.
  4. Re-enable security features one by one to identify the conflicting rule.

Troubleshooting

When the Error is Temporary

Occasional 502 errors often resolve themselves. They may be caused by brief server restarts, minor network routing issues, or momentary traffic spikes. If your website returns to normal quickly and the error does not recur, no further action is usually required.

When the Error Persists

A persistent 502 Bad Gateway error typically indicates a deeper problem. Common causes include:

If you have checked your resource usage, reviewed your logs, and verified your proxy settings without finding a cause, the issue likely resides with your hosting provider's infrastructure.

Avoid making significant changes to your DNS records or server configuration unless you are certain of the impact. Incorrect changes can take your website offline entirely.
If your business is experiencing slow load times, unreliability, or frequent timeouts, it may be time to analyse whether your current hosting plan meets your needs. Upgrading to a plan with more memory and processing power can resolve recurring 502 errors.

Still Having Issues?

Need more help? If the issue persists after trying these steps, please open a support ticket and our team will assist you.

💻 Open a Ticket