Search code examples
laravel-valetlaravel-livewire

Laravel Livewire - 502 Bad Gateway


I am using Laravel Valet in my development environment and I came across this error today when sending a post request with Livewire.

~/.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"

Solution

  • To fix it, change the following config files in your environment:

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

    After that, valet restart.

    The solution was originally posted by colbyalbo.