Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/asp.net-core/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios Heroku上的Rails 3.2应用程序,带有designe:Can';t使用Mobile Safari登录_Ios_Ruby On Rails 3_Devise_Mobile Safari - Fatal编程技术网

Ios Heroku上的Rails 3.2应用程序,带有designe:Can';t使用Mobile Safari登录

Ios Heroku上的Rails 3.2应用程序,带有designe:Can';t使用Mobile Safari登录,ios,ruby-on-rails-3,devise,mobile-safari,Ios,Ruby On Rails 3,Devise,Mobile Safari,我已经构建了一个简单的rails应用程序,并将其部署到heroku。该应用程序使用Desive进行身份验证。在开发和生产环境中一切正常,当您尝试通过iOS上的Mobile Safari浏览器登录时,请接受 Heroku日志说: 2012-10-17T18:56:52+00:00 app[web.1]: Started POST "/users/sign_in" for 87.123.175.106 at 2012-10-17 20:56:52 +0200 2012-10-17T18:56:52+

我已经构建了一个简单的rails应用程序,并将其部署到heroku。该应用程序使用Desive进行身份验证。在开发和生产环境中一切正常,当您尝试通过iOS上的Mobile Safari浏览器登录时,请接受

Heroku日志说:

2012-10-17T18:56:52+00:00 app[web.1]: Started POST "/users/sign_in" for 87.123.175.106 at 2012-10-17 20:56:52 +0200
2012-10-17T18:56:52+00:00 app[web.1]: Processing by Devise::SessionsController#create as HTML
2012-10-17T18:56:52+00:00 app[web.1]:   Parameters: {"utf8"=>"✓", "authenticity_token"=>"SHHVgAxRFJ8VFu2cnbh/YGn6s6q0L9Mnp24x9Whu2mk=", "user"=>{"name"=>"test", "password"=>"[FILTERED]"}, "commit"=>"anmelden"}
2012-10-17T18:56:52+00:00 app[web.1]: WARNING: Can't verify CSRF token authenticity
2012-10-17T18:56:53+00:00 app[web.1]: Redirected to http://xxxxxxxx.herokuapp.com/
其他iOS浏览器(如Opera)不会出现此问题。 我没有做任何定制设计(除了添加用户名),它的实现几乎是开箱即用

我读过几篇文章,其中关于iOS和CSRF令牌的问题含糊不清,但我对rails非常陌生,不知道如何解决这个问题。有人能帮忙吗

更新:

正如在帖子中建议的那样,我在application\u controller.rb中注释掉了
protect\u from\u fraze
,并在application.html.erb中注释掉了
csrf\u meta\u标记。
另外,我在config/session\u store.rb中添加了
:domain=>:all

没有任何帮助。显然,我不再收到
无法验证CSRF令牌真实性的错误,但以下日志:

2012-10-18T18:19:03+00:00 app[web.1]: Started POST "/users/sign_in" for 87.123.130.136 at 2012-10-18 20:19:03 +0200
2012-10-18T18:19:03+00:00 app[web.1]: Processing by Devise::SessionsController#create as HTML
2012-10-18T18:19:03+00:00 app[web.1]:   Parameters: {"utf8"=>"✓", "authenticity_token"=>"Q+fF+9Sj2Q+X2VV34Jkrt1K8C3u4/NB6YC3yslYjkyQ=", "user"=>{"name"=>"test", "password"=>"[FILTERED]"}, "commit"=>"anmelden"}
2012-10-18T18:19:03+00:00 heroku[router]: POST pacific-beyond-5428.herokuapp.com/users/sign_in dyno=w
eb.1 queue=0 wait=0ms service=783ms status=302 bytes=107
2012-10-18T18:19:03+00:00 app[web.1]: Redirected to http://pacific-beyond-5428.herokuapp.com/
2012-10-18T18:19:03+00:00 app[web.1]: Completed 302 Found in 577ms (ActiveRecord: 0.0ms)
2012-10-18T18:19:04+00:00 app[web.1]: 
2012-10-18T18:19:04+00:00 app[web.1]: 
2012-10-18T18:19:04+00:00 app[web.1]: Started GET "/" for 87.123.130.136 at 2012-10-18 20:19:04 +0200
2012-10-18T18:19:04+00:00 app[web.1]: Processing by HomeController#index as HTML
2012-10-18T18:19:04+00:00 app[web.1]: Completed 401 Unauthorized in 0ms
2012-10-18T18:19:04+00:00 heroku[router]: GET pacific-beyond-5428.herokuapp.com/ dyno=web.1 queue=0 wait=0ms service=12ms status=302 bytes=120
2012-10-18T18:19:04+00:00 app[web.1]: 
2012-10-18T18:19:04+00:00 app[web.1]: Started GET "/users/sign_in" for 87.123.130.136 at 2012-10-18 20:19:04 +0200
2012-10-18T18:19:04+00:00 app[web.1]: Processing by Devise::SessionsController#new as HTML
2012-10-18T18:19:04+00:00 app[web.1]: 
2012-10-18T18:19:04+00:00 app[web.1]:   Rendered layouts/_navigation.html.erb (1.4ms)
2012-10-18T18:19:04+00:00 app[web.1]:   Rendered devise/shared/_links.html.erb (0.7ms)
2012-10-18T18:19:04+00:00 app[web.1]:   Rendered devise/sessions/new.html.erb within layouts/application (25.8ms)
2012-10-18T18:19:04+00:00 app[web.1]:   Rendered layouts/_messages.html.erb (0.4ms)
2012-10-18T18:19:04+00:00 app[web.1]:   Rendered layouts/_sidebar.html.erb (0.3ms)
2012-10-18T18:19:04+00:00 app[web.1]: Completed 200 OK in 33ms (Views: 31.9ms | ActiveRecord: 0.0ms)
2012-10-18T18:19:04+00:00 heroku[router]: GET pacific-beyond-5428.herokuapp.com/users/sign_in dyno=web.1 queue=0 wait=0ms service=44ms status=200 bytes=2361
2012-10-18T18:19:04+00:00 app[web.1]: 
2012-10-18T18:19:04+00:00 app[web.1]: 
2012-10-18T18:19:04+00:00 app[web.1]: Started GET "/assets/foundation/app.js" for 87.123.130.136 at 2012-10-18 20:19:04 +0200
2012-10-18T18:19:05+00:00 app[web.1]: Compiled foundation/app.js  (0ms)  (pid 2)
2012-10-18T18:19:05+00:00 app[web.1]: Served asset /foundation/app.js - 304 Not Modified (282ms)
2012-10-18T18:19:05+00:00 heroku[router]: GET pacific-beyond-5428.herokuapp.com/assets/foundation/app.js dyno=web.1 queue=0 wait=0ms service=297ms status=304 bytes=0
2012-10-18T18:19:05+00:00 app[web.1]: 
2012-10-18T18:19:05+00:00 app[web.1]: 
2012-10-18T18:19:05+00:00 app[web.1]: Started GET "/assets/foundation/index.js" for 87.123.130.136 at 2012-10-18 20:19:05 +0200
2012-10-18T18:19:05+00:00 heroku[router]: GET pacific-beyond-5428.herokuapp.com/assets/foundation/index.js dyno=web.1 queue=0 wait=0ms service=905ms status=304 bytes=0
2012-10-18T18:19:05+00:00 app[web.1]: Compiled foundation/modernizr.foundation.js  (0ms)  (pid 2)
2012-10-18T18:19:05+00:00 app[web.1]: Compiled foundation/jquery.placeholder.js  (0ms)  (pid 2)
2012-10-18T18:19:05+00:00 app[web.1]: Compiled foundation/jquery.foundation.alerts.js  (0ms)  (pid 2)
2012-10-18T18:19:05+00:00 app[web.1]: Compiled foundation/jquery.foundation.accordion.js  (0ms)  (pid 2)
2012-10-18T18:19:05+00:00 app[web.1]: Compiled foundation/jquery.foundation.buttons.js  (0ms)  (pid 2)
2012-10-18T18:19:05+00:00 app[web.1]: Compiled foundation/jquery.foundation.tooltips.js  (0ms)  (pid 2)
2012-10-18T18:19:05+00:00 app[web.1]: Compiled foundation/jquery.foundation.forms.js  (0ms)  (pid 2)
2012-10-18T18:19:05+00:00 app[web.1]: Compiled foundation/jquery.foundation.tabs.js  (0ms)  (pid 2)
2012-10-18T18:19:05+00:00 app[web.1]: Compiled foundation/jquery.foundation.navigation.js  (0ms)  (pid 2)
2012-10-18T18:19:05+00:00 app[web.1]: Compiled foundation/jquery.foundation.topbar.js  (0ms)  (pid 2)
2012-10-18T18:19:05+00:00 app[web.1]: Compiled foundation/jquery.foundation.reveal.js  (0ms)  (pid 2)
2012-10-18T18:19:05+00:00 app[web.1]: Compiled foundation/jquery.foundation.orbit.js  (0ms)  (pid 2)
2012-10-18T18:19:05+00:00 app[web.1]: Compiled foundation/jquery.foundation.mediaQueryToggle.js  (0ms)  (pid 2)
2012-10-18T18:19:05+00:00 app[web.1]: Compiled foundation/index.js  (86ms)  (pid 2)
2012-10-18T18:19:05+00:00 app[web.1]: Served asset /foundation/index.js - 304 Not Modified (616ms)

有人有主意吗?

我也有同样的错误,我在Heroku的日志中看到了同样的生产症状:

  • 警告:无法验证CSRF令牌的真实性
  • 以及尝试登录后的401未经授权重定向
我的解决方案是将
domain::all
添加到
config/initializers/session_store.rb中的
session_store
,检查这个:似乎相关。