Authored by ccbikai

设置session域名

... ... @@ -41,15 +41,22 @@ app.use(bodyParser.json());
app.use(bodyParser.urlencoded({extended: false}));
app.use(cookieParser());
app.use(session({
proxy: true,
resave: false,
saveUninitialized: true,
unset: 'destroy',
secret: 'nothing', // 兼容 PHP SESSION,sessionID 不加密
name: 'PHPSESSID', // 兼容 PHP SESSION
genid: () => {
return uuid.v4(); // 兼容 PHP SESSION
},
proxy: true,
resave: false,
saveUninitialized: true,
unset: 'destroy',
cookie: {
domain: 'yohobuy.com',
path: '/',
httpOnly: true,
secure: false,
maxAge: null
},
store: new MemcachedStore({
hosts: config.memcache.session,
prefix: 'qinsessionsession:', // 兼容 PHP SESSION
... ...
... ... @@ -123,8 +123,6 @@ class Http {
timeout: 3000
};
console.log('in api : ' + config.useCache);
// 从缓存获取数据
if (config.useCache && cacheOption) {
return this._requestFromCache(options);
... ...