When CDN returns error 502, it means that there is some problem with the server serving static content. Possible causes include firewall, wrong permissions, failing web server and network issues.
If have ruled out other causes, it may be possible, that your application restricts access to content based on IP address. You need to disable this restriction for CDN IP addresses. You can find their current list here.