So I assume you're asking why do you get keep getting a "Bad Gateway" message with LW. So usually the reason you get that is LW and most other Lemmy instances run in whats called a container. In order to route requests, an application called nginx is used. The message you see comes from nginx not being able to properly route requests to the container for any number of reasons.
Now the reason that keeps happening, in my opinion, is two fold. First, given that they're one of, if not the largest instances they uncover performance issues before any one else does. This is good overall for Lemmy as the admins here have been very good about troubleshooting and pushing fixes upstream which helps everyone.
The second is again, being the largest they're subject to quite a few bad actors or those "doing it for the lulz". Recently the admins alluded to the fact there was a bad actor that was attempting to DDoS them and knew which Database queries hurt the most to take the instance down.
So really in that case it's not a matter of throwing more resources at it (within reason) since this bad actor is exploiting flaws in the Lemmy code base. Ironically, this is helping fix Lemmy has a whole, but has an effect of a cat and mouse game.
Likely related to the ongoing DDoS campaign(s) mentioned here:
The problem is that for a couple of hours every day we are under a DDOS attack. It’s a never-ending game of whack-a-mole where we close one attack vector and they’ll start using another one. Without going too much into detail and expose too much, there are some very ‘expensive’ sql queries in Lemmy - actions or features that take up seconds instead of milliseconds to execute. And by by executing them by the thousand a minute you can overload the database server.
I get the Cloudflare "SSL handshake failed" if I try to have a 2nd tab/window on lemmy.world open. I'm assuming it's a policy that the admins placed to limit resource use/DDoS attacks on the server.