I am sending a file using X-Accel-Redirect and including Content-Range but on django with fcgi, but nginx ignores my headers and simply sends the whole file.
resp = HttpResponse()
resp.status_code = 206
resp['X-Accel-Buffering'] = 'no'
resp['X-Accel-Redirect'] = ''.join(['/stream_d/', str(pk), '/',files[file_index][1]])
resp['Accept-Ranges'] = 'bytes'
resp['Content-Length'] = length + 1
resp['Content-Range'] = 'bytes %s-%s/%s' % (start_bytes, end_bytes, size)
Browser result:
Accept-Ranges:bytes
Connection:close
Content-Length:136751696
Content-Range:bytes 0-136751695/136751696
Content-Type:text/html; charset=utf-8
Date:Sat, 20 Jun 2015 19:34:35 GMT
ETag:"55858232-826aa50"
Last-Modified:Sat, 20 Jun 2015 15:09:38 GMT
Server:nginx/1.6.2
I want nginx to serve the file range i specified in the code, how can I accomplish that?
resp = HttpResponse()
resp.status_code = 206
resp['X-Accel-Buffering'] = 'no'
resp['X-Accel-Redirect'] = ''.join(['/stream_d/', str(pk), '/',files[file_index][1]])
resp['Accept-Ranges'] = 'bytes'
resp['Content-Length'] = length + 1
resp['Content-Range'] = 'bytes %s-%s/%s' % (start_bytes, end_bytes, size)
Browser result:
Accept-Ranges:bytes
Connection:close
Content-Length:136751696
Content-Range:bytes 0-136751695/136751696
Content-Type:text/html; charset=utf-8
Date:Sat, 20 Jun 2015 19:34:35 GMT
ETag:"55858232-826aa50"
Last-Modified:Sat, 20 Jun 2015 15:09:38 GMT
Server:nginx/1.6.2
I want nginx to serve the file range i specified in the code, how can I accomplish that?