# FastCGI problem

**URL:** <https://www.ruby-forum.com/t/fastcgi-problem/189816>\
**Category:** NGINX\
**Created:** [June 8, 2010, 10:23am UTC](https://www.ruby-forum.com/t/fastcgi-problem/189816 "2010-06-08T10:23:30Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Chancey](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/ec9cab/32.png) [@Chancey](https://www.ruby-forum.com/u/Chancey)\
**Post date:** [June 8, 2010, 10:23am UTC](https://www.ruby-forum.com/t/fastcgi-problem/189816/1 "2010-06-08T10:23:30Z")

</div>

Hi, all:

I wrote a fastcgi program to upload files, i want stop receive and wrote  
like this:

while(FCGI\_Accept() \>= 0)  
{  
if(filesize) continue;  
}

but i found nginx received all stream from brower and then send stream  
to fastcgi server.

How to immediately respond to browser ? thanks

---

<div class="post-metadata">

**Author:** ![Chancey](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/ec9cab/32.png) [@Chancey](https://www.ruby-forum.com/u/Chancey)\
**Post date:** [June 8, 2010, 10:44am UTC](https://www.ruby-forum.com/t/fastcgi-problem/189816/2 "2010-06-08T10:44:35Z")

</div>

Chancey at 2010-6-8 16:22 wrote:

> but i found nginx received all stream from brower and then send stream to fastcgi server.
> 
> How to immediately respond to browser ? thanks

No, you can’t. Nginx always buffers all the request body and then send  
it to backend together.

> * * *
> 
> nginx mailing list  
> [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
> [mailman.nginx.org archive](http://nginx.org/mailman/listinfo/nginx)

–  
Weibin Y.

---

<div class="post-metadata">

**Author:** ![Chancey](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/ec9cab/32.png) [@Chancey](https://www.ruby-forum.com/u/Chancey)\
**Post date:** [June 8, 2010, 10:56am UTC](https://www.ruby-forum.com/t/fastcgi-problem/189816/3 "2010-06-08T10:56:18Z")

</div>

Hi, Chancey,

On 08.06.2010, at 12:22, Chancey [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> but i found nginx received all stream from brower and then send  
> stream to fastcgi server.
> 
> How to immediately respond to browser ? thanks

Could you please try to limit request body size with nginx directive  
client\_max\_body\_size?

Best regards,  
Peter.

---

<div class="post-metadata">

**Author:** ![Chancey](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/ec9cab/32.png) [@Chancey](https://www.ruby-forum.com/u/Chancey)\
**Post date:** [June 8, 2010, 1:15pm UTC](https://www.ruby-forum.com/t/fastcgi-problem/189816/4 "2010-06-08T13:15:04Z")

</div>

äºŽ 2010-6-8 16:43, Weibin Y. å†™é“:

> > nginx mailing list  
> > [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
> > [mailman.nginx.org archive](http://nginx.org/mailman/listinfo/nginx)

thanks, any way else?

---

<div class="post-metadata">

**Author:** ![Chancey](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/ec9cab/32.png) [@Chancey](https://www.ruby-forum.com/u/Chancey)\
**Post date:** [June 8, 2010, 1:13pm UTC](https://www.ruby-forum.com/t/fastcgi-problem/189816/5 "2010-06-08T13:13:54Z")

</div>

äºŽ 2010-6-8 16:52, Peter L. å†™é“:

> > {  
> > client\_max\_body\_size?
> 
> Best regards,  
> Peter.
> 
> * * *
> 
> nginx mailing list  
> [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
> [mailman.nginx.org archive](http://nginx.org/mailman/listinfo/nginx)

thanks, I have tried to set client\_max\_body\_size.  
for example, i set client\_max\_body\_size = 50M, when upload filesize  
larger than 50M that nginx will receive data to 50M and then respond  
browser the httpcode “413”.  
Still a waste of bandwidth.
