fastcgi and X-Accel-Redirect

Maxim Dounin mdounin at mdounin.ru
Mon Dec 21 03:57:43 MSK 2009


Hello!

On Sun, Dec 20, 2009 at 10:41:58PM +0100, Jaroslav Gresula wrote:

> Jaroslav Gresula wrote:
> > I use nginx 8.22 and flup (a fastcgi python server). When I send a file
> > using the X-Accel-Redirect header then flup reports "Connection reset by
> > peer" error - but nginx still delivers the file.
> >
> > Sending a file in the response body (i.e. the standard way) works well.
> >
> > Does anyone have any idea what might be causing that ECONNRESET?
> >
> 
> Update:
> 
> Closer inspection in wireshark shows that nginx sends RST roughly in a
> half of cases whereas the other half of connections is closed correctly.
> 
> In the successful cases, nginx receives response headers + another 4
> packets and then flup is the one who closes the connection.
> 
> In the failed cases, nginx sends FIN,ACK followed by RST right after it
> receives response headers.
> 
> Any ideas why nginx is sending RST?

nginx closes backend connection right after it receives full 
headers with X-Accel-Redirect.  No idea why on your system this 
implies RST.  Are you running nginx under Windows?

Maxim Dounin



More information about the nginx mailing list