diff --git a/server/controllers/session.js b/server/controllers/session.js index a6dcb4fdaaa..b60b4447ad8 100644 --- a/server/controllers/session.js +++ b/server/controllers/session.js @@ -191,6 +191,7 @@ const handleLogin = async ctx => { } if (authAuthorizeUrl) { + ctx.cookies.set('authAuthorizeUrl', null); ctx.body = { success: true, redirect: authAuthorizeUrl, diff --git a/server/proxy.js b/server/proxy.js index dc76f9034b2..e5be7088eca 100644 --- a/server/proxy.js +++ b/server/proxy.js @@ -141,7 +141,10 @@ const oauthProxy = { target, changeOrigin: true, optionsHandle(options, req, ctx) { - ctx.cookies.set('authAuthorizeUrl', req.url); + // if not login, redirect to login page + if (!ct.cookies.get('token')) { + ctx.cookies.set('authAuthorizeUrl', req.url); + } }, events: { proxyReq(proxyReq, req) {