Authored by 周奇琪

http头加shopId。灰度,如果是ajax,需要设置cookie

@@ -18,7 +18,7 @@ var guestAccessList = { @@ -18,7 +18,7 @@ var guestAccessList = {
18 18
19 var NO_AUTH = '没有权限!'; 19 var NO_AUTH = '没有权限!';
20 20
21 -var WEBSITE = 1; 21 +var WEBSITE = 2;
22 22
23 var CSS_FILE = '/dist/login.css'; 23 var CSS_FILE = '/dist/login.css';
24 24
@@ -144,6 +144,7 @@ function appendAdminInfo(req,auth) { @@ -144,6 +144,7 @@ function appendAdminInfo(req,auth) {
144 'x-user-id':auth.pid, 144 'x-user-id':auth.pid,
145 'x-user-name':auth.account, 145 'x-user-name':auth.account,
146 'x-site-type':WEBSITE, 146 'x-site-type':WEBSITE,
147 - 'x-client-ip':ip 147 + 'x-client-ip':ip,
  148 + 'x-shop-id':auth.shopId
148 }; 149 };
149 } 150 }
@@ -58,7 +58,7 @@ module.exports = function(proxyRoute) { @@ -58,7 +58,7 @@ module.exports = function(proxyRoute) {
58 logger.log('info','grayroute: request options: %j',options,{}); 58 logger.log('info','grayroute: request options: %j',options,{});
59 59
60 //发起代理请求 60 //发起代理请求
61 - if(req.headers['accept'].indexOf('text/html')>-1) { 61 + if(req.headers['accept'].indexOf('text/html')>-1||req.xhr) {
62 request(options,function(err,res,body) { 62 request(options,function(err,res,body) {
63 if(err) { 63 if(err) {
64 logger.log('error','grayroute: request error:',err); 64 logger.log('error','grayroute: request error:',err);