简体   繁体   English

全新安装Lion后,我的应用似乎没有在会话中存储任何内容

[英]After doing a fresh install of Lion my app doesn't seem to be storing anything in the session

I just did a fresh install of Lion and now my app doesn't seem to be able to have anything stored in the session. 我刚刚重新安装了Lion,现在我的应用似乎无法在会话中存储任何内容。

What happens in my app is: 我的应用程序中发生的是:

  1. I navigate to the login page 我导航到登录页面
  2. Enter valid credentials 输入有效的凭证
  3. The app authenticates me ( I have verified that the @user_session.save call returns true) 该应用程序对我进行身份验证(我已验证@ user_session.save调用返回true)
  4. I get redirected to the page that logged in users get redirected to 我被重定向到登录用户的页面被重定向到
  5. However, user_session is actually nil, so CanCan then raises an AccessDenied exception 但是,user_session实际上为nil,因此CanCan然后会引发AccessDenied异常
  6. I get redirected to the login page 我被重定向到登录页面

Throughout this whole process no flash messages are displayed. 在整个过程中,不会显示任何Flash消息。 Also, my app would typically save the last page that the user tried to visit when an AccessDenied exception is raised. 另外,当引发AccessDenied异常时,我的应用程序通常会保存用户尝试访问的最后一页。 However, nothing is in the session after I am redirected to the login page. 但是,重定向到登录页面后,会话中什么都没有。 Not even the typical "Please login" flash message. 甚至没有典型的“请登录”快速消息。

Everything was working before my reinstall. 重新安装之前,一切正常。 What could cause this? 是什么原因造成的?

Turns out the problem was with the fact that I was using subdomains. 原来问题出在我正在使用子域的事实上。 When I tried the site using localhost:3000, the session would not persist. 当我使用localhost:3000尝试该站点时,该会话将不会持续。 However, using lvh.me fixed everything. 但是,使用lvh.me修复了所有问题。

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

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