def download_file(request):
response = HttpResponse(open("test.zip"), content_type='application/zip')
response['Content-Disposition'] = 'attachment; filename=test.zip'
response['Content-Type'] = 'application/x-zip'
return response
server {
listen 27796;
server_name myurl.com;
root /home/ucwsri/webapps/static_media_ucwsri_nginx;
location / {
autoindex on;
}
location ^~ /protected/ {
internal;
}
response = HttpResponse()
url = "/protected/some-file.pdf"
response['X-Accel-Redirect'] = url
return response