Valet 502 Bad Gateway nginx/1.19.1

I believe you have to increase the buffer size for your headers,

open Users/YOUR-USER/.config/valet/Nginx/WEBSITE.test

Add the lines below after each fastcgi_pass line

fastcgi_buffers 16 16k;
fastcgi_buffer_size 32k;

then

valet restart

Good luck! Hope this helps


I added this to http in /usr/local/etc/nginx/nginx.conf and this fixed my issue with Magento 2, it might help for wordpress too

fastcgi_buffering on;
fastcgi_buffers 4 256k;
fastcgi_buffer_size 128k;