You would need to diagnose this at a server-level, I'm afraid. As it is a server error, we cannot tell you what and why this is happening.
If you use a WAF, like CloudFlare, ensure you're not exceeding any pre-set limits inherent in that service either.