From cebc343893ab424d4128a41e5ab0c363dbfffa78 Mon Sep 17 00:00:00 2001 From: fanfpy Date: Wed, 2 Jul 2025 14:44:29 +0800 Subject: [PATCH] =?UTF-8?q?refactor(traefik):=20=E7=BB=9F=E4=B8=80API?= =?UTF-8?q?=E8=B7=AF=E5=BE=84=E5=89=8D=E7=BC=80=E5=B9=B6=E8=B0=83=E6=95=B4?= =?UTF-8?q?=E6=9C=8D=E5=8A=A1=E8=B7=AF=E7=94=B1=E8=A7=84=E5=88=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 为traefik仪表板API添加路径前缀/traefik-api - 将前端服务路由路径从/改为/frontend - 统一数据服务、用户服务、情感服务和推荐服务的API路径为/api/前缀 --- consul/config/data-service.json | 2 +- consul/config/emotion-service.json | 2 +- consul/config/frontend.json | 2 +- consul/config/recommend-service.json | 2 +- consul/config/user-service.json | 2 +- traefik/traefik.yml | 3 ++- 6 files changed, 7 insertions(+), 6 deletions(-) diff --git a/consul/config/data-service.json b/consul/config/data-service.json index 3eafe98..3abf2e8 100644 --- a/consul/config/data-service.json +++ b/consul/config/data-service.json @@ -9,7 +9,7 @@ "id": "data-service-1", "tags": [ "traefik.enable=true", - "traefik.http.routers.data-service.rule=PathPrefix(`/api-data`)", + "traefik.http.routers.data-service.rule=PathPrefix(`/api/data`)", "traefik.http.routers.data-service.entrypoints=web" ], "name": "data-service", diff --git a/consul/config/emotion-service.json b/consul/config/emotion-service.json index cf69960..ed41d81 100644 --- a/consul/config/emotion-service.json +++ b/consul/config/emotion-service.json @@ -9,7 +9,7 @@ "id": "emotion-service-1", "tags": [ "traefik.enable=true", - "traefik.http.routers.emotion-service.rule=PathPrefix(`/api-emotion`)", + "traefik.http.routers.emotion-service.rule=PathPrefix(`/api/emotion`)", "traefik.http.routers.emotion-service.entrypoints=web" ], "name": "emotion-service", diff --git a/consul/config/frontend.json b/consul/config/frontend.json index c0c512a..5ad7795 100644 --- a/consul/config/frontend.json +++ b/consul/config/frontend.json @@ -9,7 +9,7 @@ "id": "frontend-1", "tags": [ "traefik.enable=true", - "traefik.http.routers.frontend.rule=PathPrefix(`/`)", + "traefik.http.routers.frontend.rule=PathPrefix(`/frontend`)", "traefik.http.routers.frontend.entrypoints=web" ], "name": "frontend", diff --git a/consul/config/recommend-service.json b/consul/config/recommend-service.json index 6bfbf3a..098c2cb 100644 --- a/consul/config/recommend-service.json +++ b/consul/config/recommend-service.json @@ -9,7 +9,7 @@ "id": "recommend-service-1", "tags": [ "traefik.enable=true", - "traefik.http.routers.recommend-service.rule=PathPrefix(`/api-recommend`)", + "traefik.http.routers.recommend-service.rule=PathPrefix(`/api/recommend`)", "traefik.http.routers.recommend-service.entrypoints=web" ], "name": "recommend-service", diff --git a/consul/config/user-service.json b/consul/config/user-service.json index c293f9d..fbbcf9c 100644 --- a/consul/config/user-service.json +++ b/consul/config/user-service.json @@ -9,7 +9,7 @@ "id": "user-service-1", "tags": [ "traefik.enable=true", - "traefik.http.routers.user-service.rule=PathPrefix(`/api-user`)", + "traefik.http.routers.user-service.rule=PathPrefix(`/api/user`)", "traefik.http.routers.user-service.entrypoints=web" ], "name": "user-service", diff --git a/traefik/traefik.yml b/traefik/traefik.yml index 84f204b..1d6a00a 100644 --- a/traefik/traefik.yml +++ b/traefik/traefik.yml @@ -11,4 +11,5 @@ providers: api: dashboard: true - insecure: true \ No newline at end of file + insecure: true + pathPrefix: "/traefik-api" \ No newline at end of file