I recenly started gettting 504 from Laravel app using valet had some issues while debugging it. Basically it boils down to NGINX.
Add these values to your server or http block.
fastcgi_buffers 8 128k;
Just make sure after adding values to
valet.conf file you run
If this don't help try to perform
valet install but make sure to backup your valet settings from
~/.config/valet/ because after running the command some settings might revert to defaults which may be not obvious from the get go!
Hope this solves your issue!
Have a nice day!