-
-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
reverse proxy: fastcgi buffer requests for fastcgi by default #6759
Conversation
I tested #6759, looks like fixed returns 411 Length Required problem. Caddyfile:
phpMyAdmin is installed in the root directory of the website, after entering username and password, I can not log in.
Downgrade to v2.8.4 or just revert #6661 was no problem. |
After commit 3ba88fe |
Hi. Checked this out and it fixes the 411 problem and PHPMyAdmin works well as well... Great job! Thank you! |
// php-fpm will hang if there is any data in the body though, https://github.com/caddyserver/caddy/issues/5420#issuecomment-2415943516 | ||
|
||
// TODO: better default buffering for fastcgi requests without content length, in theory a value of 1 should be enough, make it bigger anyway | ||
if module, ok := h.Transport.(caddy.Module); ok && module.CaddyModule().ID.Name() == "fastcgi" && h.RequestBuffers == 0 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't love that we implement this hack like this cause it means transport implementations don't have control over their buffering setup. Can we make an optional interface that transports can implement to override the default request buffer size? Default to zero, but implement that func in fastcgi transport for this. Would allow any transport plugin to fix this as well if necessary. (But... if we think this is just a temporary hack that will be reworked later anyway once we have full buffering implemented then this is fine?)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree this shouldn't be a long-term solution, and I think I like the implicit interface idea alright, so let's revisit that in another issue. But yeah, this should do for now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you everyone who tested this. And especially thank you to @WeidiDeng for the quick fix!
Can someone elaborate more on the I'm not asking that my particular problem is debugged, I am just trying to understand the solution to this problem. Can someone point me in the right direction? |
This comment has been minimized.
This comment has been minimized.
@bminer Compile caddy from |
Fix 6757.
Apparently nginx buffers fastcgi requests by default.
We just set a low default buffering to allow most common requests to succeed. Requests without content length and buffering won't work either in theory. But it's likely some requests have empty body, just without content length. If requests do have a no-empty body, the requests will likely hang, as demonstrated here.
A smaller value may be possible to fix the empty body without content length. But use a larger buffer by default to ignore explicit configuration for common cases.