X-Accel-Redirect and Content-Length Header
is at rambler-co.ru
Fri May 11 09:07:52 MSD 2007
On Thu, May 10, 2007 at 02:45:00PM -0700, Geoffrey Grosenbach wrote:
> First, thanks to all those who work on Nginx. It's a fantastic web
> server and has made my life easier in many ways.
> Technical details: Using Nginx 0.5.19 with Mongrel and Ruby on Rails
> My problem is that content sent with X-Accel-Redirect doesn't send a
> Content-Length header. I'm sending 100-200 MB files and it would be
> nice if the client can have a progress bar to tell them how much there
> is left to download. Without the Content-length header, they just see
> "10 MB of ? remaining" in the web browser.
> I tried sending a Content-length header from my Rails app with the
> X-Accel-Redirect header, but it seems to be stripped out of the
> headers when sent to the client. I also tried adding the header
> manually in the nginx.config, but it's always sends 0.
> add_header Content-Length $content_length;
> My last resort was to hard-code a reasonable value for the Content-Length
> add_header Content-Length 150000000;
> This works, but isn't optimal.
> Can anyone recommend a good way to do this?
nginx should send Content-Length from XAR'ed file.
If nginx does not send it could you show debug log ?
More information about the nginx