fix: 修复公开页面因旧 Cookie 验签失败误返回 401
浏览器会自动给每个请求携带 q4_token,gateway 重启轮换内存 RSA 密钥后旧凭证验签失败,导致无需登录的公开页面也 401。代理层改为仅对需鉴权目标校验凭证,公开目标跳过;前端遇 401 自动跳转登录页自愈。
This commit is contained in:
1 parent
b2ddd9e7e3
commit
4ad3fbfca8
2 files changed
+40
-13
No files matched your search
@@ -28,6 +28,12 @@ async function getNode(id) {
|
||||
throw new Error('服务器响应格式异常,请稍后重试');
|
||||
}
|
||||
|
||||
if (res.status === 401) {
|
||||
// 凭证失效(过期或网关重启),跳转重新登录
|
||||
location.href = '/login.html';
|
||||
return;
|
||||
}
|
||||
|
||||
if (!res.ok) {
|
||||
throw new Error(result.message || `获取节点失败(HTTP ${res.status})`);
|
||||
}
|
||||
@@ -80,6 +86,12 @@ async function addNode(pid, title, content) {
|
||||
throw new Error('服务器响应格式异常,请稍后重试');
|
||||
}
|
||||
|
||||
if (res.status === 401) {
|
||||
// 凭证失效(过期或网关重启),跳转重新登录
|
||||
location.href = '/login.html';
|
||||
return;
|
||||
}
|
||||
|
||||
if (!res.ok) {
|
||||
throw new Error(`添加节点失败(HTTP ${res.status})`);
|
||||
}
|
||||
@@ -133,6 +145,12 @@ async function deleteNode(id) {
|
||||
throw new Error('服务器响应格式异常,请稍后重试');
|
||||
}
|
||||
|
||||
if (res.status === 401) {
|
||||
// 凭证失效(过期或网关重启),跳转重新登录
|
||||
location.href = '/login.html';
|
||||
return;
|
||||
}
|
||||
|
||||
if (!res.ok) {
|
||||
throw new Error(`删除节点失败(HTTP ${res.status})`);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user