This likely isn't due to Laravel but due to how you have things setup. If your using Nginx or Apache check their logs and it may give you insight into what's causing the bad gateway.
Thanks, seems like the problem is starting from here after composer global update:
Problem 1
- laravel/homestead[v10.3.0, ..., v10.17.0] require php ^7.1 -> your php version (8.0.0) does not satisfy that requirement.
- Root composer.json requires laravel/homestead ^10.3 -> satisfiable by laravel/homestead[v10.3.0, ..., v10.17.0].
I solved it. Many things had to happen, starting from running composer global update, then valet install and many more runs.
Composer dependencies need a specific version of PHP
Turns out I had updated composer to the latest version (--2) and Laravel didn't liked that, somehow that meant that my dependencies that were using a version of php (7.4) were no longer working because of this action/update (I think php updated to 8.0 version in this process when Composer got the update)
So all in all
I had to review which version of php I was using and use that version with brew link [email protected] in my case I had to overwrite, a message pops out telling you how to do this overwrite.
After I solved my issues with valet, no longer was I receiving the 502 Gateway message but I had a message from Firefox telling me the connection couldn't be made (or something)
After this I started to receive the message that my composer dependencies used a version of PHP 7.4 and I was using a 7.3, this is when I had to run composer self-upgrade 1.10.17
For anyone having this problem more recently: if using Herd, this may be easily fixed by checking the PHP version and making sure it's using the most recent.