X-Accel-Redirect and Content-Length Header
Geoffrey Grosenbach
boss at topfunky.com
Fri May 11 01:45:00 MSD 2007
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?
Thanks,
Geoffrey Grosenbach
........................
Blog | http://nubyonrails.com
Podcast | http://podcast.rubyonrails.com
Screencast | http://peepcode.com
More information about the nginx
mailing list