Laravel-debugbar: Ajax calls 502 bad gateway

Created on 5 Jan 2015  路  8Comments  路  Source: barryvdh/laravel-debugbar

With version 1.8.1 no problem.

In version 1.8.2 and later if capture_ajax is enabled, Every ajax call finish with a 502 bad gateway.
Any solution?

In localhost there is no problem, only server.

Most helpful comment

@sergiodebcn I had the same 502 problem and after some debugging discovered that I was hitting a limit inside nginx, not a problem in PHP.
I added the following to my site conf and things seem to be working now:

fastcgi_temp_file_write_size 10m;
fastcgi_busy_buffers_size 512k;
fastcgi_buffer_size 512k;
fastcgi_buffers 16 512k;

Idk if you have nginx on your localhost, but look into your server config.

All 8 comments

I don't really have an idea. It's only when the debugbar is enabled right?
Any logs or error messages?

Only with debugbar enabled, Only shows a 502 bad gateway

@sergiodebcn I had the same 502 problem and after some debugging discovered that I was hitting a limit inside nginx, not a problem in PHP.
I added the following to my site conf and things seem to be working now:

fastcgi_temp_file_write_size 10m;
fastcgi_busy_buffers_size 512k;
fastcgi_buffer_size 512k;
fastcgi_buffers 16 512k;

Idk if you have nginx on your localhost, but look into your server config.

thanks @ryan953 , I'll try this config.

I can confirm that disabling capture_ajax fixes the 502 problem.

@ryan953 Adding these

fastcgi_temp_file_write_size 10m;
fastcgi_busy_buffers_size 512k;
fastcgi_buffer_size 512k;
fastcgi_buffers 16 512k;

Also fixed my problem, I can now enable capture_ajax.

Goggled into this thread to solve this same problem for our development environments. However, after a lot of testing we determined that only the fastcgi_buffer_size and fastcgi_buffer settings needed to be updated. There's a very interesting article that you could use to help zero in on the appropriate buffer sizes here. For our environment here are the settings we used.

fastcgi_buffer_size         64K;
fastcgi_buffers          16 64K;

Encounter the same issue when using the debugbar for an Inertiajs based application in laravel valet.

Checked the error log

tail -5 ~/.config/valet/Log/nginx-error.log
[error] 272#0: *22475 upstream sent too big header while reading response header from upstream, client: 127.0.0.1, ...

So I edit the valet.conf with cli

nano /usr/local/etc/nginx/valet/valet.conf 

Added the fastcgi params provided above.

   location ~ [^/]\.php(/|$) {
        fastcgi_split_path_info ^(.+\.php)(/.+)$;
        fastcgi_pass "unix:/Users/chaiwei/.config/valet/valet.sock";
        fastcgi_index "/Users/chaiwei/.composer/vendor/laravel/valet/server.php";
        include fastcgi_params;
fastcgi_buffer_size         64K;
fastcgi_buffers          16 64K;
        fastcgi_param SCRIPT_FILENAME "/Users/chaiwei/.composer/vendor/laravel/valet/server.php";
        fastcgi_param PATH_INFO $fastcgi_path_info;
    }

then restart valet

valet restart
Was this page helpful?
0 / 5 - 0 ratings

Related issues

Thijmen picture Thijmen  路  6Comments

alphametric picture alphametric  路  5Comments

coderdiaz picture coderdiaz  路  4Comments

beneverard picture beneverard  路  6Comments

lozadaOmr picture lozadaOmr  路  6Comments