If you’re just behind an Nginx instance with a configuration like this, this shouldn’t cause these kinds of issues.
We need more details to help you. If this happens again, can you capture details of the error? What URL is your Discourse instance available at? What exactly do you mean by “clearing CDN cache” – can you describe what you’re doing, exactly?