Django CSRF check failing with an Ajax POST request

前端 未结 22 1442
佛祖请我去吃肉
佛祖请我去吃肉 2020-11-22 03:46

I could use some help complying with Django\'s CSRF protection mechanism via my AJAX post. I\'ve followed the directions here:

http://docs.djangoproject.com/en/dev/r

22条回答
  •  死守一世寂寞
    2020-11-22 04:09

    In my case the problem was with the nginx config that I've copied from main server to a temporary one with disabling https that is not needed on the second one in the process.

    I had to comment out these two lines in the config to make it work again:

    # uwsgi_param             UWSGI_SCHEME    https;
    # uwsgi_pass_header       X_FORWARDED_PROTO;
    

提交回复
热议问题