Laravel Livewire - 502 错误网关

Laravel Livewire - 502 Bad Gateway

我在我的开发环境中使用 Laravel Valet,今天我在使用 Livewire 发送 post 请求时遇到了这个错误。

~/.config/valet/Log/nginx-error.log:

2020/05/17 10:44:27 [error] 3611#0: *1 upstream sent too big header while reading response header from upstream, client: 127.0.0.1, server: , request: "POST /livewire/message/autocomplete.users HTTP/1.1", upstream: "fastcgi://unix:/Users/macuser/.config/valet/valet.sock:", host: "blog.test", referrer: "http://blog.test/dashboard"

要修复它,请在您的环境中更改以下配置文件:

  1. 创建文件~/.config/valet/Nginx/all.conf
proxy_buffer_size   4096k;
proxy_buffers   128 4096k;
proxy_busy_buffers_size   4096k;
  1. 附加到文件 /usr/local/etc/nginx/fastcgi_params
fastcgi_buffer_size 4096k;
fastcgi_buffers 128 4096k;
fastcgi_busy_buffers_size 4096k;

之后,valet restart.

解决方案最初由 colbyalbo 发布。