Tuesday, June 30, 2015

Django REST Cross Domain Request to Download a File

So I am trying to download a file via Django REST (referred to as the Back End from now on) instance through my web page. The web page and the Back End are currently installed on two different servers so this is a cross domain request.

Now, I have no problem making cross domain requests to any of the other API urls on the Back End, but this one that retrieves the file through a view I am struggling with.

The response comes back with status 200 (OK) and the headers all seem to be set correctly, but no download is forced.

I have tried using Ajax requests and XMLHttpRequests in Javascript but the response just doesnt force a download despite containing the correct Content-disposition header.

Any thoughts would be well appreciated. 
Thanks

G

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/91fd9f44-57b4-44d7-8a45-3eb0743de45b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment