Hello. I have next problem.
Here is my location for download in nginx
location /test {
lua_code_cache off;
content_by_lua_file download.lua;
}
Contents of donwload.lua file:
local lfs = require "lfs"
local file_path = '/home/front/public_html/storage/0000000011';
ngx.header["Content-Type"] = 'application/octet-stream';
ngx.header["Content-Disposition"] = 'attachment; filename="111a"';
ngx.header["Content-Length"] = lfs.attributes(file_path,"size");
ngx.header["X-Accel-Redirect"] = '/storage/0000000011';
if ngx.var.limit_rate then
ngx.header["X-Accel-Limit-Rate"] = ngx.var.limit_rate;
end
The location "storage"
location ^~ /storage/ {
root /home/front/public_html/; internal;
}
But after i tried to download by accessing /test/ location. it asks me to save the file but download doesn't starts.
Here is a headers from lynx
HTTP/1.1 200 OK
Server: nginx
Date: Wed, 26 Dec 2012 19:25:53 GMT
Content-Type: application/octet-stream
Connection: close
Content-Disposition: attachment; filename="111a"
Content-Length: 18195
X-Accel-Redirect: /storage/0000000011
X-Accel-Limit-Rate: 51200
What i'm doing wrong ? Please help me.