Skip to content

Commit

Permalink
fix: solve client api request that can't handle 302 redirects
Browse files Browse the repository at this point in the history
Signed-off-by: lingbo <[email protected]>
  • Loading branch information
lingbohome committed Dec 5, 2024
1 parent 1254513 commit 2074f16
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion server/middlewares/checkToken.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion server/middlewares/proxy.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down

0 comments on commit 2074f16

Please sign in to comment.