Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CSRF protection return 403 because of removing other cookies #116

Open
molavy opened this issue Mar 1, 2016 · 3 comments
Open

CSRF protection return 403 because of removing other cookies #116

molavy opened this issue Mar 1, 2016 · 3 comments

Comments

@molavy
Copy link

molavy commented Mar 1, 2016

there is django csrf protection
on calling filedownload post data that return csrf failed
https://docs.djangoproject.com/en/1.9/ref/csrf/

@johnculviner
Copy link
Owner

i dont use django but certainly let me know if you find a solution and/or make a PR

@Falldog
Copy link

Falldog commented Jun 24, 2016

For Django CSRF token protection
fileDownload need add csrftoken parameter
currently, you just need add correct csrf value to do it

Example:

$.fileDownload(url, {
    httpMethod: "POST",
    csrfmiddlewaretoken: "{{csrf_token}}",
    parameter: your_paramter,
})

@pyMan
Copy link

pyMan commented May 7, 2018

There's a problem with iPad and django (1.11.6) on POST requests.

It seems Safari is not setting/sending the document.referrer, so the CsrfViewMiddleware will reject the request with error 403 because it suspects about a man-in-the-middle attack.

fileDownload when dealing with isIos devices opens a new window.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants