How to solve the 502 bad gateway error

This error means that the server received an invalid response from an incoming server. In this article we will explain how to solve it!

Max avatar
Written by Max
Updated over a week ago

When you notice the 502 Bad gateway error it’s not something to directly stress about, it is often easy to fix but can take some time. This error specifically means that the server received an invalid response from an incoming server. In this article we will explain to you how to solve it!

One of the most common reasons for a 502 error is when your server is taking to long in order for response. Another reason can be a bad designed plugin or theme that is sending to many requests, what results in a server that takes a long time to respond. Another reason could be that your server is not correctly configured by your hosting.

How to solve this error yourself?

  • Delete your cache
    To fix it, on a Mac you can use the key combination Command + Shift + R to do a “hard” refresh, or on Windows computers Control + F5. If this doesn’t work, try to manually delete the cache from your browser. Especially with browsers such as Google Chrome. If this doesn’t solve your 502 error, please keep reading.

  • Increase your PHP time limit
    Your PHP time limit is to define how long a request can take to complete. The best thing to do is increasing your PHP time limit. How, is written in this article: How do you increase the PHP time limit

  • Update all your plugins and themes
    This is always recommended to do in order to prevent any issues/errors including the 502 bad gateway error.

  • Turn your Firewall and/or your CDN
    If you make use of these services there can be an issue with the setup. Therefore, temporarily disable your firewall or CDN to see if that solves the problem. when disabling your CDN and firewall, you may need to delete your cache to make sure this fixes the issue. If this solved your problem, activate again your CDN and/or firewall to see if the problem recurs. If so, please contact the party where you have your CDN and/or firewall running.

  • When above did not solve the issue, please contact your hosting to assist you.
    They should support you solving this because there can be an issue with your hosting-server. tell them you have completed the steps above but unfortunately without a positive outcome.


    Can’t figure it out? You can always send a message to the support team via the chat bubble at the bottom right 🎈 Support to the rescue 👨‍💻 👩‍💻

Did this answer your question?