Valet: Valet 2.0.3: 500 Bad Gateway (upstream sent too big header)

Created on 10 Jan 2017  路  7Comments  路  Source: laravel/valet

PHP stack traces are getting cut off by Nginx with the error upstream sent too big header while reading response header from upstream.

Would it be possible to change the way PHP stack traces are delivered, or to increase the limit for this issue?

Here's an example stack trace from ~/.valet/Log/nginx-error.log:

2017/01/09 18:15:35 [error] 41481#0: *1 FastCGI sent in stderr: "PHP message: PHP Warning:  A non-numeric value encountered in /Users/jplhomer/Documents/Sites/site/content/plugins/advanced-custom-fields-pro/pro/fields/flexible-content.php on line 1470
PHP message: PHP Warning:  A non-numeric value encountered in /Users/jplhomer/Documents/Sites/site/content/plugins/advanced-custom-fields-pro/pro/fields/flexible-content.php on line 1470
PHP message: PHP Warning:  A non-numeric value encountered in /Users/jplhomer/Documents/Sites/site/content/plugins/advanced-custom-fields-pro/pro/fields/flexible-content.php on line 1470
PHP message: PHP Warning:  A non-numeric value encountered in /Users/jplhomer/Documents/Sites/site/content/plugins/advanced-custom-fields-pro/pro/fields/flexible-content.php on line 1470
PHP message: PHP Warning:  A non-numeric value encountered in /Users/jplhomer/Documents/Sites/site/content/plugins/advanced-custom-fields-pro/pro/fields/flexible-content.php on line 1470
PHP message: PHP Warning:  A non-numeric value encountered in /Users/jplhomer/Documents/Sites/site/content/plugins/advanced-custom-fields-pro/pro/fields/flexible-content.php on line 1470
PHP message: PHP Warning:  A non-numeric value encountered in /Users/jplhomer/Documents/Sites/site/content/plugins/advanced-custom-fields-pro/pro/fields/flexible-content.php on line 1470
PHP message: PHP Warning:  A non-numeric value encountered in /Users/jplhomer/Documents/Sites/site/content/plugins/advanced-custom-fields-pro/pro/fields/flexible-content.php on line 1470
PHP message: PHP Warning:  A non-numeric value encountered in /Users/jplhomer/Documents/Sites/site/content/plugins/advanced-custom-fields-pro/pro/fields/flexible-content.php on line 1470
PHP message: PHP Warning:  A non-numeric value encountered in /Users/jplhomer/Documents/Sites/site/content/plugins/advanced-custom-fields-pro/pro/fields/flexible-content.php on line 1470
PHP message: PHP Warning:  A non-numeric value encountered in /Users/jplhomer/Docu
2017/01/09 18:15:35 [error] 41481#0: *1 upstream sent too big header while reading response header from upstream, client: 127.0.0.1, server: site.dev, request: "GET /wordpress/wp-admin/post.php?post=5411&action=edit&message=1 HTTP/2.0", upstream: "fastcgi://unix:/Users/jplhomer/.valet/valet.sock:", host: "site.dev", referrer: "https://site.dev/wordpress/wp-admin/post.php?post=5411&action=edit"

Most helpful comment

@drbyte is helpful, but it took me some time to make suggested StackOverflow link work with Valet.

  1. Create ~/.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;

_Note: 4096k is something you need to figure out what best works for you._

All 7 comments

Since you're using https://site.dev that tells me you've run valet secure and therefore you have a ~/.valet/Nginx/site.dev file for your Nginx config.

In that file you can edit the configuration details, so I might suggest trying the suggestions at http://stackoverflow.com/questions/13894386/upstream-too-big-nginx

And whenever you make changes to your nginx configs, you'll need to either valet restart or sudo brew service restart nginx to take effect.

That's where I'd start anyway ...

@drbyte Thanks - that helped me. Oddly enough, I'm still seeing a stream of errors now in the Nginx error log, but no errors served in the browser. I'm able to finish what I needed to get done, though 馃憤 Don't know if this is something to address with the default Valet setup.

@drbyte is helpful, but it took me some time to make suggested StackOverflow link work with Valet.

  1. Create ~/.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;

_Note: 4096k is something you need to figure out what best works for you._

@elaman thanks, your suggestion fixed the issue for me. Why wouldn't this be a default I wonder? Perhaps more default allowances should be set I guess

The solution in https://github.com/laravel/valet/issues/290#issuecomment-398686133 worked for me.
This was with a Drupal 8 site that outputs a lot of headers when developing, this wasn't even outputting a stack trace or similar :)

@drbyte is helpful, but it took me some time to make suggested StackOverflow link work with Valet.

  1. Create ~/.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;

_Note: 4096k is something you need to figure out what best works for you._

This solved a similar issue I had today. 馃檹

@drbyte is helpful, but it took me some time to make suggested StackOverflow link work with Valet.

  1. Create ~/.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;

_Note: 4096k is something you need to figure out what best works for you._

Thanks buddy

Was this page helpful?
0 / 5 - 0 ratings

Related issues

idmahbub picture idmahbub  路  3Comments

Flimm picture Flimm  路  5Comments

Alshie picture Alshie  路  4Comments

eberkund picture eberkund  路  4Comments

dustinleblanc picture dustinleblanc  路  4Comments