Authored by 陈峰

Merge branch 'feature/redis' into 'release/6.9.2'

Feature/redis



See merge request !1742
... ... @@ -78,10 +78,21 @@ app.disable('x-powered-by');
app.use('/node/status.html', (req, res) => {
return res.status(200).end();
});
app.head('*', (req, res) => {
res.status(200).end();
});
app.use((req, res, next) => {
req.url = stringProcess.decodeURIComponent(req.url) || '/404';// 错误的网址编码重定向404
req.isApmReport = _.get(req.app.locals, 'wap.open.bughd', false); // 把错误上报的开关绑定到上下文,node-lib 库要使用
let isSpider = /spider/i.test(req.get('User-Agent') || '');
if (config.aliasDomains.some(d => d === req.hostname) || isSpider) {
// 如果是非m.yohobuy.com域名(无法设置sessionid到cookie域名不同)且是爬虫访问,session降级使用cookiesession
req.session = {
degrage: true
};
}
next();
});
... ...
... ... @@ -13,9 +13,9 @@ const isTest = process.env.NODE_ENV === 'test3' || process.env.NODE_ENV === 'tes
const domains = {
api: 'http://api.yoho.cn/',
// api: 'http://api.yoho.cn/',
service: 'http://service.yoho.cn/',
// service: 'http://service.yoho.cn/',
// yoLuck: 'https://action.yoho.cn',
... ... @@ -28,8 +28,8 @@ const domains = {
// platformApi: 'http://172.16.6.210:8088/',
// api: 'http://api-test3.dev.yohocorp.com/',
// service: 'http://api-test3.dev.yohocorp.com/',
api: 'http://api-test3.dev.yohocorp.com/',
service: 'http://api-test3.dev.yohocorp.com/',
liveApi: 'http://testapi.live.yohops.com:9999/',
singleApi: 'http://api-test3.dev.yohocorp.com/',
ufo: 'http://java-yohoufo-fore.test3.ingress.dev.yohocorp.com/ufo-gateway/',
... ... @@ -61,6 +61,7 @@ module.exports = {
signExtend: {
business_line: 'yohobuy'
},
aliasDomains: ['activity.yoho.cn'],
report: {
host: 'badjs.yoho.cn',
port: 80,
... ...
... ... @@ -20,7 +20,8 @@ function yohoSession(opts) {
opts.backSession = opts.backSession || 'session2';
if (req.session && !notUseRedis) {
if (req.session && !req.session.degrage && !notUseRedis) {
// 如果存在session并且没有被降级,且移除redis开关没开,则继续使用session redis
req.sessionError = false;
} else {
// 重建 session
... ...