thinkjs / thinkjs

Use full ES2015+ features to develop Node.js applications, Support TypeScript.
https://thinkjs.org/
MIT License
5.31k stars 617 forks source link

会话问题 #1410

Open hrj904064990 opened 5 years ago

hrj904064990 commented 5 years ago

DESC

ENV

OS Platform:

Node.js Version:

ThinkJS Version:

code

// your code here

error message

// your error message here

more description

// your detail description 在线下环境下,可以通过this.cookie('thinkjs')获取到session对应的cookie,但是线上环境下却无法获取到session对应的cookie。

hrj904064990 commented 5 years ago

adapter.js的配置

exports.session = {
  type: 'file',
  common: {
    timeout: 24 * 60 * 60 * 1000,// millisecond
    cookie: {
      name: 'thinkjs',
      keys: ['signature key'],
      signed: true
    }
  },
  file: {
    handle: fileSession,
    sessionPath: path.join(think.ROOT_PATH, 'runtime/session')
  }
}
lushijie commented 5 years ago

你线上几台机器?

hrj904064990 commented 5 years ago

只有一台

hrj904064990 commented 5 years ago

没有东西返回

hrj904064990 commented 5 years ago

undefined

lushijie commented 5 years ago

那你看看 file 有内容不, debug一下 think-session/ think-session-file.

lushijie commented 5 years ago

让你整蒙了,我想成 cache 了。。。 你为啥不 await this.session('name'),你为啥取 cookie 去。。。

hrj904064990 commented 5 years ago

我做的登录功能需要cookie和session同时作用