ruby-on-rails – ActionController :: InvalidAuthenticityToken和域名

栏目: Ruby · 发布时间: 6年前

内容简介:翻译自:https://stackoverflow.com/questions/23507181/actioncontrollerinvalidauthenticitytoken-and-domain-names

我发现使用诸如foo.bar.uk.com之类的域会导致Rails在提交任何表单时抛出ActionController :: InvalidAuthenticityToken.

foo.bar.co.uk和foo.bar.co.com工作,但由于某种原因foo.bar.uk.com抛出错误.

某处是否有可接受的域/ TLD列表?

它还会在foo.bar.eu.com上抛出错误

更新:

删除:

:domain => :all

从:

MyApp::Application.config.session_store :cookie_store, key: '_my_session', :domain => :all

允许表单提交,但它不修复登录(即其他cookie相关的功能).

当您的项目部署在包含多个TLD的域中时,Rails会感到困惑.在Rails 3中,如果您正在使用它,则必须更改文件config / initializers / session_store.rb.

Rails.application.config.session_store :cookie_store, {
  key: 'YOUR KEY, THIS VALUE IS ALREADY DEFINED',
  domain: '.co.uk'
}

希望能帮助到你

翻译自:https://stackoverflow.com/questions/23507181/actioncontrollerinvalidauthenticitytoken-and-domain-names


以上所述就是小编给大家介绍的《ruby-on-rails – ActionController :: InvalidAuthenticityToken和域名》,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对 码农网 的支持!

查看所有标签

猜你喜欢:

本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们

The Photoshop Anthology

The Photoshop Anthology

Corrie Haffly / SitePoint Pty. Ltd. / 2006 / USD 39.95

The Photoshop Anthology is full-color, question-and-answer book for Web Designers who want to use Photoshop to build Websites and create better looking web graphics more effectively. The book covers: ......一起来看看 《The Photoshop Anthology》 这本书的介绍吧!

CSS 压缩/解压工具
CSS 压缩/解压工具

在线压缩/解压 CSS 代码

随机密码生成器
随机密码生成器

多种字符组合密码

正则表达式在线测试
正则表达式在线测试

正则表达式在线测试