Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prevent 502 errors when using AJAX #1079

Merged
merged 3 commits into from
Dec 2, 2022
Merged

Prevent 502 errors when using AJAX #1079

merged 3 commits into from
Dec 2, 2022

Conversation

mattkingshott
Copy link
Contributor

When using the Laravel DebugBar with the capture_ajax flag set to true, developers may encounter 502 Bad Gateway errors. This is due to DebugBar's AJAX request monitoring exceeding the FastCGI buffer limit.

This PR increases the size of the buffer. While it is not guaranteed to fix the problem, the increased buffer size should solve the issue for most developers. Further discussion on this subject can be found in this issue on the DebugBar repo.

When using the Laravel DebugBar with the `capture_ajax` flag set to `true`, its AJAX request monitoring exceeds the FastCGI buffer limit. This results in Nginx throwing a 502 Bad Gateway exception. 

This PR increases the size of the buffer. While it is not guaranteed to fix the problem, the increased buffer size should solve the issue for most developers. Further discussion on this subject can be [found in this issue on the DebugBar repo](barryvdh/laravel-debugbar#251)
@drbyte
Copy link
Contributor

drbyte commented Jul 29, 2021

Is it intentional that this only applies to unsecured sites? ie: only on sites for which valet secure has NOT been run?

The change you're proposing is in the config file used only for unsecured sites.
If one wishes this to be applied to both secured and unsecured sites, note that both types of site stubs have an include fastcgi_params directive, meaning the proposed changes could be placed in that file instead.

Also, is the temp_file_write_size and busy_buffers part really needed? Forcing unneeded settings on every Valet user can lead to unexpected outcomes.

@mattkingshott
Copy link
Contributor Author

Thanks for the comments @drbyte. It wasn't intentional no, so I've done the following...

I've moved the required parameters to fastcgi_params and removed the unnecessary ones.

@drbyte
Copy link
Contributor

drbyte commented Jul 29, 2021

Wondering: How does doing this affect RAM demands on sites? eg: what are the new requirements for using Valet?

@mattkingshott
Copy link
Contributor Author

mattkingshott commented Jul 29, 2021

I’ve not noticed any difference with it enabled, but maybe it’s usage would increase by up to 1 MB for a request (based on the 512 K buffer size). Just guessing, really have no idea.

@mattstauffer
Copy link
Collaborator

There are a lot of people in this thread either talking about this or emoji responding positively to the folks talking about it, so I'm going to consider it tested enough, and merge it. Thanks!

@mattstauffer mattstauffer merged commit 9216b9a into laravel:master Dec 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants