You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
42 lines
1.3 KiB
42 lines
1.3 KiB
/**
|
|
* 各云平台 / 容器编排常见 HTTP 探针路径(不含 `/`,避免误伤站点根)。
|
|
* 可按负载均衡控制台实际配置增删;若与业务路由同名请从列表中移除对应项。
|
|
*/
|
|
export const CLOUD_PROBE_PATHS = [
|
|
// 通用 / Kubernetes
|
|
"/health",
|
|
"/healthz",
|
|
"/livez",
|
|
"/readyz",
|
|
"/liveness",
|
|
"/readiness",
|
|
"/startup",
|
|
"/health/live",
|
|
"/health/ready",
|
|
"/health/startup",
|
|
// Spring Actuator(经网关暴露时偶见)
|
|
"/actuator/health",
|
|
"/actuator/health/liveness",
|
|
"/actuator/health/readiness",
|
|
// Azure App Service 相关默认探测
|
|
"/robots933456.txt",
|
|
// 国内云控制台常见示例静态页
|
|
"/check.html",
|
|
"/status.html",
|
|
"/ping",
|
|
"/status",
|
|
"/alive",
|
|
] as const;
|
|
|
|
/** 阿里云等:健康检查为 `/rpc` 或带后缀路径(如控制台填写的 `/rpc/...`),按前缀匹配 */
|
|
export const CLOUD_PROBE_PATH_PREFIXES = ["/rpc"] as const;
|
|
|
|
export const CLOUD_PROBE_PATH_SET = new Set<string>(CLOUD_PROBE_PATHS);
|
|
|
|
export function isCloudProbePath(pathname: string): boolean {
|
|
if (CLOUD_PROBE_PATH_SET.has(pathname)) return true;
|
|
for (const prefix of CLOUD_PROBE_PATH_PREFIXES) {
|
|
if (pathname === prefix || pathname.startsWith(`${prefix}/`)) return true;
|
|
}
|
|
return false;
|
|
}
|
|
|