2 messages in ru.sysoev.nginxRe: X-Accel-Redirect and Content-Leng...
FromSent OnAttachments
Geoffrey GrosenbachMay 10, 2007 2:44 pm 
Igor SysoevMay 10, 2007 10:07 pm 
Actions with this message:
Paste this link in email or IM:
Paste this link in email or IM:
Atom feed for this thread
Paste this URL into your reader:
Subject:Re: X-Accel-Redirect and Content-Length HeaderActions...
From:Igor Sysoev (is-G@public.gmane.org)
Date:May 10, 2007 10:07:29 pm
List:ru.sysoev.nginx

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 ?