If you are using MaxCDN Content Delivery Network with your website or WordPress blog and you suddenly start seeing 502 Bad Gateway error, then following are the things you should do before panicking, jumping and contacting MaxCDN support:
1. Check if your origin IP address has been changed: Origin IP address is the IP address of the web server on which your website is currently hosted. If you move your site to some other server or your web host suddenly changes your account IP address without notifying you (this thing rarely happens), then you will start seeing 502 error as various edge server of MaxCDN can’t communicate with the origin.
In order to check your correct origin IP address, open command prompt on your computer and try pinging your website. When you ping your website, the IP address displayed in the command prompt should match with the origin IP present in your CDN’s Control Panel:
If they don’t match then you should update the origin IP address immediately and your site should start working in a matter of few minutes.
2. Purge your Cache: You should try purging your cache by going to Manage cache and then click on Purge All button. This will delete all files from various CDN servers and all edge servers are forced to rebuild the zone or file cache from the origin server on the immediate next request:
3. Bad Zone Settings: If you have recently created a pull or push zone and immediately after that you start seeing 502 error, then you should check your zone settings once again. Chances are very high that you (or some other user) have entered something wrong in the settings.
4. Check MaxCDN Server status: You can check the current status of various edge server of MaxCDN here and here. If services of a particular server is disrupted, then you will see a red exclamation mark in front of it along with service disruption and uptime percentage written:
Click on the name of affected edge server and you will be able to see its current performance and availability status:
When service disruption occurs MaxCDN generally reroute all traffic to some other working edge server. There is nothing you can do, but you may want to contact their support and ask them whether you are seeing a 502 error because of this.
5. Check your host’s Server and Network status: If your web server or data centre network is partially down OR there is some sort of maintenance going on, then the edge servers may not be able to communicate with the origin properly.
You should check the network status page or forum of your host and see if there’s any ongoing maintenance or downtime. You can also contact them via a support ticket or live chat.
6. Whitelist MaxCDN IP addresses in Firewall: Your host may completely block IP addresses of MaxCDN using a firewall to mitigate ongoing DDoS attacks on their server.
If you suddenly start seeing Bad Gateway error and you have followed all the above mentioned 5 steps, then you should immediately contact your host and ask them whether they have recently added IP addresses in their firewall blacklist. If they say YES, then you should contact MaxCDN and ask them to send you a list of IP addresses that should be in the whitelist of your host:
Note: Do not use above IP addresses as they might become useless after sometime. You should always contact MaxCDN and ask them for a fresh list.