Was alerted by one of my readers that one of my blogs was not displaying any images or the theme .css files correctly and after doing some digging I found that if I hit my CDN dns name URL it would return 502 Gateway errors.
A quick search on MaxCDN support site showed that this error typically only occurs in 1 of 3 situations.
Provisioning Error on MaxCDN Side
This is the rarest occurrence of the issue and they say open a ticket with them if you rule out the other two issues first. In my case my problem was not related to a provisioning error.
Firewall Blocking CDN
Firewalls can sometimes block IP addresses in MaxCDN network this can happen also if you use something like Cloudflare in front of MaxCDN where it filters IP’s. In some cases it could be blocking of MaxCDN and web hosting server or browser client, many companies can use proxies to filter web traffic too. Either way this was not my situation either, so on to the final reason specified.
Web Hosting Provider IP has Changed
When you use a shared hosting account with a web hosting company you are subject to changes without notice. Rarely but still happens is when an IP changes for the shared hosting you were using. This basically is where all web instances on the same shared server change IP’s. In this case this wound up being my issue.
All I had to do to confirm this was go into your Shared Hosting Control Panel (CPanel) and look at the Shared IP:
Then compare this IP with the IP listed in your MaxCDN Pull Zone:
If they don’t match then update the IP in your MaxCDN Pull Zone. In this case this screenshot was taken after I had already corrected it but they didn’t match when I was getting the 502 Gateway Error from the MaxCDN Caching URL.
A quick update of the Pull Zone and my site content was restored within seconds. This was the first time in over a year I had seen my hosting provider IP for my web server change so I don’t think is a super common issue, but if you have 502 Gateway errors when using MaxCDN service then one of these steps should be where to look.
On another note, MaxCDN has a great service plan which I use which is a 1TB consume as you go plan. You basically pay $39.99 for 1TB of bandwidth and only pay more when you consume it. DragonBlogger.com which gets over 100k pageviews per month uses about 130GB per month average, this means I get about 8 months of quality CDN for only $39.99 which is much less expensive than using Amazon S3 or other CDN providers I have tested. If you aren’t using MaxCDN yet for your WordPress blog it can be configured in minutes and you leverage it through the W3 Total Cache plugin. It will speed up your page load times and serve content up faster and is worth it as I gained about 35% improvement in pageload times over using Cloudflare and about 20% over using Amazon S3 itself.
Cloudflare however being free is still a great way to speed up your site and leverage caching to reduce load on your servers. You can also leverage some of the performance benefits of Cloudflare while still using MaxCDN and I use Cloudflare with MaxCDN in some cases you would just have Cloudflare protect your site and make sure your CDN DNS URL had Cloudflare disabled on it.
To get $10 off MaxCDN Pay As You Go Plan, just use code WPBEGINNER when you sign up now with the Pay As You Go Plan.