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.

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. For cPanel users, navigate to Metrics > Resource Usage.
  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. For cPanel users, navigate to Metrics > Errors or open the error.log file for your domain via File Manager.
  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.

Third-Party CDN and Proxy Services

If you use a third-party service such as Cloudflare, the 502 error may be occurring between the CDN and your origin server rather than on your hosting account.

  1. Visit the status page for your CDN provider (for example, the Cloudflare Status page) to check for ongoing outages.
  2. If the service is operational, try temporarily pausing the CDN or switching to "DNS Only" mode in your provider's dashboard to see if the origin server is the source of the error.
  3. Verify that your origin server IP is correct in the CDN settings.

Guidance for Managed Hosting and Website Builders

If you use a managed hosting provider or a website builder platform, you may not have access to server logs or a traditional control panel.

  1. Check the provider's status page or system health dashboard for reported incidents.
  2. Review any built-in analytics or uptime monitoring tools provided by the platform.
  3. If you cannot access logs or server settings, proceed directly to contacting your provider's support team.

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.

Contacting Your Hosting Provider

When escalating the issue to your hosting provider, include the following information to help them diagnose the problem quickly:

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 you make DNS changes, remember that propagation can take up to 48 hours, during which time some visitors may still see the old server or experience errors.
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