Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CSRF Referer checking failed Django 1.8

I have searched about this but could not find any workable solution.

I have a website like www.example.com and subdomains a.example.com and b.example.com. When I try to post a request from a.example.com to b.example.com I get the error of Referer checking failed.

I have following settings in a.example.com and b.example.com:

CSRF_COOKIE_DOMAIN = ".example.com"

But I am not able to make use of CSRF_COOKIE_DOMAIN correctly.

like image 513
Waqas Javed Avatar asked Jul 08 '15 12:07

Waqas Javed


1 Answers

Django 1.8 has strict referer checking for HTTPS. You cannot post from a.example.com to b.example.com with CSRF protection enabled in Django 1.8.

With Django 1.9 they added CSRF trusted origins.

like image 73
Pankrat Avatar answered Oct 02 '22 23:10

Pankrat