Authored by ccbikai

设置session域名

@@ -41,15 +41,22 @@ app.use(bodyParser.json()); @@ -41,15 +41,22 @@ app.use(bodyParser.json());
41 app.use(bodyParser.urlencoded({extended: false})); 41 app.use(bodyParser.urlencoded({extended: false}));
42 app.use(cookieParser()); 42 app.use(cookieParser());
43 app.use(session({ 43 app.use(session({
  44 + proxy: true,
  45 + resave: false,
  46 + saveUninitialized: true,
  47 + unset: 'destroy',
44 secret: 'nothing', // 兼容 PHP SESSION,sessionID 不加密 48 secret: 'nothing', // 兼容 PHP SESSION,sessionID 不加密
45 name: 'PHPSESSID', // 兼容 PHP SESSION 49 name: 'PHPSESSID', // 兼容 PHP SESSION
46 genid: () => { 50 genid: () => {
47 return uuid.v4(); // 兼容 PHP SESSION 51 return uuid.v4(); // 兼容 PHP SESSION
48 }, 52 },
49 - proxy: true,  
50 - resave: false,  
51 - saveUninitialized: true,  
52 - unset: 'destroy', 53 + cookie: {
  54 + domain: 'yohobuy.com',
  55 + path: '/',
  56 + httpOnly: true,
  57 + secure: false,
  58 + maxAge: null
  59 + },
53 store: new MemcachedStore({ 60 store: new MemcachedStore({
54 hosts: config.memcache.session, 61 hosts: config.memcache.session,
55 prefix: 'qinsessionsession:', // 兼容 PHP SESSION 62 prefix: 'qinsessionsession:', // 兼容 PHP SESSION
@@ -123,8 +123,6 @@ class Http { @@ -123,8 +123,6 @@ class Http {
123 timeout: 3000 123 timeout: 3000
124 }; 124 };
125 125
126 - console.log('in api : ' + config.useCache);  
127 -  
128 // 从缓存获取数据 126 // 从缓存获取数据
129 if (config.useCache && cacheOption) { 127 if (config.useCache && cacheOption) {
130 return this._requestFromCache(options); 128 return this._requestFromCache(options);