![](/img/trans.png)
[英]ActionController::InvalidAuthenticityToken (ActionController::InvalidAuthenticityToken): Rails 5
[英]Rails 4: InvalidAuthenticityToken
我在我的应用程序网站上: subdomain.lvh.me:3000/new
: subdomain.lvh.me:3000/new
与
= link_to "Delete", item_url(@item, subdomain: ""), method: :delete
如果单击该链接,我将重定向到正确的URL,但出现此错误:
ItemsController#destroy中的ActionController :: InvalidAuthenticityToken ActionController :: InvalidAuthenticityToken
旁注:
http://lvh.me:3000/
创建了本地存储对象
知道为什么会这样吗? Devise本身可在所有子域中使用。
日志:
Started DELETE "/items/322146979" for 127.0.0.1 at 2016-12-13 18:03:18 +0100
Processing by ItemsController#destroy as HTML
Parameters: {"subdomain"=>"", "id"=>"322146979"}
Can't verify CSRF token authenticity
Completed 422 Unprocessable Entity in 1ms (ActiveRecord: 0.0ms)
我认为这并不是因为Devise,您将子域传递为空,所以将redirects_s重定向到http://lvh.me:3000/,而您位于http://subdomain.lvh.me:3000 。 因此,它正在考虑作为一个单独的站点。 因此,它提出了CSRF真实性令牌。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.