Authored by 陈峰

commit

... ... @@ -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) {
console.log('close session');
req.session = {
degrage: true
};
}
next();
});
... ... @@ -115,6 +126,7 @@ app.use(compression());
require('./doraemon/middleware/yoho-session')(app);
app.use((req, res, next) => {
console.log(req.session);
req.user = {}; // 全局的用户数据
req.yoho = {}; // req和res绑定yoho对象,用于传递全局数据, 如req.yoho.channel等
req.app.locals.wap = app.locals.wap; // zookeper对象赋值
... ...
... ... @@ -13,9 +13,10 @@ 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',
// liveApi: 'http://testapi.live.yohops.com:9999/',
... ... @@ -27,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/',
... ... @@ -60,6 +61,7 @@ module.exports = {
signExtend: {
business_line: 'yohobuy'
},
aliasDomains: ['activity.yoho.cn'],
report: {
host: 'badjs.yoho.cn',
port: 80,
... ...
... ... @@ -20,7 +20,7 @@ function yohoSession(opts) {
opts.backSession = opts.backSession || 'session2';
if (req.session && !notUseRedis) {
if (req.session && !req.session.degrage && !notUseRedis) {
req.sessionError = false;
} else {
// 重建 session
... ...