【问题标题】:Migrated to CF2018 and having problems with sessions迁移到 CF2018 并遇到会话问题
【发布时间】:2019-10-01 14:03:26
【问题描述】:

我最近将一个应用从 CF2010 迁移到 CF2018,当用户登录时我们遇到了会话问题。

添加一些转储和中止我看到会话在有效登录时成功设置,但是在使用 cflocation 或 cfheader 时它会丢失会话(application.cfc 重新运行 onSessionStart)。我的 application.cfc 看起来像:

this.applicationTimeout = createTimeSpan(0,8,0,0);
this.sessionmanagement = true;
this.clientmanagement = false;
this.sessiontimeout = createTimeSpan(0,0,20,0);
this.scriptProtect = "all";  
this.setClientCookies = true;
this.showDebugOutput = false;
this.enablecfoutputonly = false;

onSessionStart 非常简单:

public void function onSessionStart() {
  lock scope="session" type="exclusive" timeout="10" {
    session.started = now();
    session.loggedIn = false;
  };
  lock scope="application" type="exclusive" timeout="5" {
    application.sessions = application.sessions + 1;
  };

  writeLog(file = "g-session-log", type = "information", application = "no", text = "session started:");
};

在处理登录页面时,我可以看到日志文件获得了一个条目。在服务器管理员中,我选中了“使用 J2EE 会话变量”和“启用会话变量”。 Cookie 超时为 1440,选中 HTTPOnly 并选中“禁用使用 ColdFusion 标签/功能更新 ColdFusion 内部 cookie”。

【问题讨论】:

    标签: coldfusion application.cfc


    【解决方案1】:

    发现问题 - 回答以防其他人遇到此问题。在我的onApplicationStart() 中,我设置了一个 http 和 https 站点根目录。在<cflocation> 上称为application.secureSiteRoot,但因为我将SSL 证书移到那里进行测试,所以我将其设置为http,而不是https。这阻止了 cookie 的设置。

    【讨论】:

      猜你喜欢
      • 2011-01-16
      • 2021-04-28
      • 2015-12-04
      • 1970-01-01
      • 1970-01-01
      • 2019-04-16
      • 2019-12-30
      • 2013-11-13
      • 2015-08-08
      相关资源
      最近更新 更多