Jul 27, 2020 · Updated: Jul 12, 2021 · by Tim Kamanin
If you're getting a weird 502 Bad Gateway error with Laravel Valet and, most probably Drupal, chances are your Nginx error log is screaming:
upstream sent too big header while reading response header from upstream.
This is because such resource hogs as Drupal send too big payloads when running in development (or any? ;) mode, and as a result, Nginx fails.
But we can fix that. And no, you don't have to throw Drupal away (most probably you should, but finish the project for the client first).
~/.config/valet/Nginxdirectory and create or edit
Add the following contents to it:
proxy_buffer_size 128k; proxy_buffers 4 256k; proxy_busy_buffers_size 256k; fastcgi_buffers 16 16k; fastcgi_buffer_size 32k; fastcgi_busy_buffers_size 32k;
And you should be good again! Ha-ha Drupal, eat that, you won't ruin my day this time!
Hey, if you've found this useful, please share the post to help other folks find it: