简体   繁体   English

Laravel通过Ajax调用和AWS负载均衡器丢失了CSRF令牌

[英]Laravel missing CSRF token via Ajax call and AWS load balancer

Since I moved a Laravel 5.4 project to AWS, most of the Ajax request is throwing an error TokenMismatchException in VerifyCsrfToken.php line 68 . 自从我将Laravel 5.4项目移至AWS以来,大多数Ajax请求TokenMismatchException in VerifyCsrfToken.php line 68错误。 I don't know what else I can do to fix it. 我不知道该如何解决。 Another info that could be important is that I am using a load balancer between 2 servers. 另一个可能很重要的信息是我正在2个服务器之间使用负载平衡器。

In all request, I send the X-CSRF-TOKEN on the header and the _token at the form data. 在所有请求中,我在标头上发送X-CSRF-TOKEN ,在表单数据上发送_token

Sometimes the request works but sometimes don't. 有时请求有效,但有时无效。

Thanks 谢谢

如上面@ Michael-sqlbot所述,通过启用粘性来解决。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM