From 5af50cc066c80dd1f96a2f9ffb5405caba3a75d5 Mon Sep 17 00:00:00 2001 From: fanfpy Date: Sun, 6 Jul 2025 12:28:20 +0800 Subject: [PATCH] =?UTF-8?q?fix(consul):=20=E6=B7=BB=E5=8A=A0Traefik?= =?UTF-8?q?=E4=B8=AD=E9=97=B4=E4=BB=B6=E4=BB=A5=E5=89=A5=E7=A6=BB/api/data?= =?UTF-8?q?=E5=89=8D=E7=BC=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 添加stripprefix中间件配置,确保请求路由到data-service时剥离/api/data前缀,避免路径不匹配问题 --- consul/config/data-service.json | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/consul/config/data-service.json b/consul/config/data-service.json index 5647c89..16bfa16 100644 --- a/consul/config/data-service.json +++ b/consul/config/data-service.json @@ -10,7 +10,9 @@ "tags": [ "traefik.enable=true", "traefik.http.routers.data-service.rule=PathPrefix(\"/api/data\")", - "traefik.http.routers.data-service.entrypoints=web" + "traefik.http.routers.data-service.entrypoints=web", + "traefik.http.middlewares.data-service-strip.stripprefix.prefixes=/api/data", + "traefik.http.routers.data-service.middlewares=data-service-strip" ], "name": "data-service", "port": 8000