Fixing "upstream sent too big header while reading response header from upstream" error in Laravel Valet NginxJul 27, 2020 · 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).
A recipe for sanity:
- Go to
~/.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;
- Save the
- Restart valet:
bash valet restart
And you should be good again! Ha-ha Drupal, eat that, you won't ruin my day this time!