streaming dynamic downloads?

Igor Sysoev is at rambler-co.ru
Sun May 18 09:46:40 MSD 2008


On Sat, May 17, 2008 at 11:34:17PM -0400, jeff emminger wrote:

> [SOLVED]
> 
> On Sat, May 17, 2008 at 10:23 PM, jeff emminger <jemminger at gmail.com> wrote:
> > I have a php app running through fastcgi, and there's a page where I
> > stream out a file for the user to download:
> >
> >        $output = dynamically_generated_content();
> >        header("Content-type: application/octet-stream");
> >        header("Content-disposition: attachment; filename=somefile.xml");
> >        echo $output;
> >
> > This works fine in apache, but in nginx all I get is a zero-size file
> > called 'somefile' (no extension)
> >
> > Is there a way to make this work?  The file is generated on the fly.
> >
> > Thanks,
> > Jeff
> >
> 
> Turned out to be a problem with the URL I was using.  I was pointing
> to "/export?xml" (no trailing slash), and Nginx was redirecting to
> "/export/" (with trailing slash) but dropping the querystring.  I
> changed my link to point to "/export/?xml" and all is well.  The
> zero-kb file download was a result of my script expecting the file
> format in the querystring, and not finding the format it generated
> nothing and sent back the empty file.

What nginx version do you use ? This bug (dropping the querystring) has
been fixed in 0.6.8 and 0.5.32.


-- 
Igor Sysoev
http://sysoev.ru/en/





More information about the nginx mailing list