diff --git a/server/middlewares/checkToken.js b/server/middlewares/checkToken.js index a48b4fb41fa..e6876cd67b9 100644 --- a/server/middlewares/checkToken.js +++ b/server/middlewares/checkToken.js @@ -15,7 +15,7 @@ module.exports = async (ctx, next) => { ctx.cookies.set('token', data.token); ctx.cookies.set('expire', data.expire); ctx.cookies.set('refreshToken', data.refreshToken); - return ctx.redirect(ctx.headers.referer || '/'); + ctx.req.token = data.token; } } } diff --git a/server/middlewares/proxy.js b/server/middlewares/proxy.js index 3140bc86dff..3cf2938b276 100644 --- a/server/middlewares/proxy.js +++ b/server/middlewares/proxy.js @@ -17,7 +17,7 @@ module.exports = (context, options) => (ctx, next) => { if (!regex.test(ctx.path)) return next(); - ctx.req.token = ctx.cookies.get('token'); + ctx.req.token = ctx.req.token || ctx.cookies.get('token'); const { events, ...httpProxyOpts } = options;