Saturday, December 1, 2012

Re: Django login twice required when using xsendfile with apache

and another issue: using apache, even when the user is logged in and is_staff, he is redirected to the login page, and he needs to login to download the file, and this continues on.

On Sat, Dec 1, 2012 at 7:30 PM, Loai Ghoraba <loai1991@gmail.com> wrote:
Hi

I am using apache2 server with xsend file to protect against static files, the python view is:

@staff_member_required
def media_xsendfile(request, path, document_root):
    print "is staff",request.user.is_staff
    response = HttpResponse()
    response['Content-Disposition'] = 'attachment'
    response['X-Sendfile'] = (os.path.join(document_root, path)).encode('utf-8')
    return response

and in apache httpd.conf

XSendFile on
XSendFilePath /path/to/files/

If the user is not a staff member, he is redirected correctly to the login page and once he login, the file is download, this is only in the local development server, however when I use apache server, after the first login nothing happens (the login page is still there) and he has to login again.for the file to be downloaded.

Any clue ?

Thanks

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/_5o_fX1N6n0J.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

No comments:

Post a Comment