Rename csrfmiddlewaretoken
1 answer
This is a string hardcoded in django / middleware / csrf.py :
# Check non-cookie token for match.
request_csrf_token = ""
if request.method == "POST":
request_csrf_token = request.POST.get('csrfmiddlewaretoken', '')
if request_csrf_token == "":
# Fall back to X-CSRFToken, to make things easier for AJAX,
# and possible for PUT/DELETE.
request_csrf_token = request.META.get('HTTP_X_CSRFTOKEN', '')
But there is a one-sided approach for you. You can add your js function which will add HTTP_X_CSRFTOKEN to your POST requests.
Find in documents .
+1
source to share