Skip to content

Instantly share code, notes, and snippets.

@bohman
Last active November 30, 2018 08:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bohman/53c9a57b1ce3e27988b5299f7cf3b8a0 to your computer and use it in GitHub Desktop.
Save bohman/53c9a57b1ce3e27988b5299f7cf3b8a0 to your computer and use it in GitHub Desktop.
Valet 502 bad gateway - upstream sent too big header

Valet is awesome, but I got seemingly random 502 bad gateway issues on larger sites. After looking in the logs (~/.config/valet/Log) I discovered the error was upstream sent too big header. Googling led me to laravel/valet#290 where the following solution fixed it:

  1. Create ~/.config/valet/Nginx/all.conf with this:
proxy_buffer_size   4096k;
proxy_buffers   128 4096k;
proxy_busy_buffers_size   4096k;
  1. Append this to /usr/local/etc/nginx/fastcgi_params
fastcgi_buffer_size 4096k;
fastcgi_buffers 128 4096k;
fastcgi_busy_buffers_size 4096k;

This solved my problem. You'll need to restart valet / nginx for the new conf to take effect:

valet restart

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment