From 2cf90db0b19caa876051ab95014dfe4fea1ca0ec Mon Sep 17 00:00:00 2001 From: hailin Date: Tue, 3 Mar 2026 21:39:32 -0800 Subject: [PATCH] =?UTF-8?q?fix(admin-service):=20=E7=A7=BB=E9=99=A4?= =?UTF-8?q?=E5=85=A8=E5=B1=80=E5=89=8D=E7=BC=80=E6=8E=92=E9=99=A4=E8=A7=84?= =?UTF-8?q?=E5=88=99=20=E2=80=94=20=E8=AE=A9=20app/version=20=E8=B7=AF?= =?UTF-8?q?=E7=94=B1=E6=AD=A3=E7=A1=AE=E5=93=8D=E5=BA=94=20/api/v1=20?= =?UTF-8?q?=E5=89=8D=E7=BC=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Kong 以 strip_path=false 转发 /api/v1/app/version/check,但服务排除了该路径的 全局前缀,导致 404。去掉 exclude 后所有路由统一挂载在 /api/v1 下。 Co-Authored-By: Claude Sonnet 4.6 --- backend/services/admin-service/src/main.ts | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/backend/services/admin-service/src/main.ts b/backend/services/admin-service/src/main.ts index 87900a2..ead979a 100644 --- a/backend/services/admin-service/src/main.ts +++ b/backend/services/admin-service/src/main.ts @@ -6,10 +6,8 @@ import { AdminModule } from './admin.module'; async function bootstrap() { const app = await NestFactory.create(AdminModule); - // Global prefix for admin APIs; mobile client endpoints excluded - app.setGlobalPrefix('api/v1', { - exclude: ['app/version/(.*)'], - }); + // Global prefix — applies to all routes including mobile client endpoints + app.setGlobalPrefix('api/v1'); app.useGlobalPipes(new ValidationPipe({ whitelist: true, transform: true })); app.enableCors();