开发者

Django: 'CSRF verification failed' only happens on one computer!

开发者 https://www.devze.com 2023-03-19 01:04 出处:网络
I have a strange issue here with my Django app. I implemented the user auth/profiles, and I can log in successfully, etc, with various computers and from three different internet locations. It all wor

I have a strange issue here with my Django app. I implemented the user auth/profiles, and I can log in successfully, etc, with various computers and from three different internet locations. It all works, except for this one computer.

This one compu开发者_运维技巧ter receives this error when they log in.

CSRF verification failed. Request aborted. No CSRF or session cookie.

I tried testing various browsers on this one computer, all get the same error. I even tested logging in on another computer from the same internet, and it works just fine. I believe this test reveals that it is not an internet problem, and it is a general computer setting problem (not specific browser).

I'm afraid that if this error happens with this one computer, if I go live, there may be other computers out there with the same issue. Is there anything I can do to check to see why it is happening only on this one machine, and more importantly, how I would fix it?

I'm hosting the app on some computer using the Django dev server.

Thanks a lot.


It could be that the error is misleading. When I have seen a problem with logins for applications that impact only one computer, but multiple browsers, it has usually been a problem with the date that computer is set to interacting with expiring cookies.

For example, this one computer may be set with a date 1 month into the future and the cookie being sent is being expired instantly because it is only a 90 minute session cookie.

So while it's not even really a Django related answer, check the clock on that computer. :-)

0

精彩评论

暂无评论...
验证码 换一张
取 消