I was editing my theme’s function.php file. I just wanted to add cookies so I added some lines of code and saved it. but after that my website showed this error. So I deleted that code and tried again but still the same. I am sure that I didn’t delete any other code
I have a feeling that some work is being done on the servers in the form of maintenance, so 502 can happen here and there, but I’m glad it didn’t last.