Welcome! Log In Create A New Profile

Advanced

Set content range for nginx

Posted by insightering 
Set content range for nginx
June 21, 2015 01:28PM
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?
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 151
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 500 on July 15, 2024
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready