From 6ecb0603bbcd01bc097ccdcbfba3eb421cd43615 Mon Sep 17 00:00:00 2001 From: fanfpy Date: Wed, 2 Jul 2025 17:37:18 +0800 Subject: [PATCH] =?UTF-8?q?fix(traefik/consul):=20=E7=BB=9F=E4=B8=80?= =?UTF-8?q?=E8=B7=AF=E5=BE=84=E8=A7=84=E5=88=99=E8=AF=AD=E6=B3=95=E5=B9=B6?= =?UTF-8?q?=E6=9B=B4=E6=96=B0API=E8=B7=AF=E5=BE=84=E5=89=8D=E7=BC=80?= =?UTF-8?q?=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 将Traefik路由规则中的路径语法从反引号(`)改为双引号(")以保持一致性 同时将traefik.yml中的pathPrefix改为pathPrefixes以支持数组格式 --- consul/config/data-service.json | 2 +- consul/config/emotion-service.json | 2 +- consul/config/frontend.json | 2 +- consul/config/quant-service.json | 2 +- consul/config/recommend-service.json | 2 +- consul/config/user-service.json | 2 +- consul/config/whoami.json | 2 +- traefik/traefik.yml | 2 +- 8 files changed, 8 insertions(+), 8 deletions(-) diff --git a/consul/config/data-service.json b/consul/config/data-service.json index 3abf2e8..5647c89 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 ed41d81..4346591 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 5ad7795..9263a19 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(`/frontend`)", + "traefik.http.routers.frontend.rule=PathPrefix(\"/frontend\")", "traefik.http.routers.frontend.entrypoints=web" ], "name": "frontend", diff --git a/consul/config/quant-service.json b/consul/config/quant-service.json index bcff10f..521438d 100644 --- a/consul/config/quant-service.json +++ b/consul/config/quant-service.json @@ -9,7 +9,7 @@ "id": "quant-service-1", "tags": [ "traefik.enable=true", - "traefik.http.routers.quant-service.rule=PathPrefix(`/api/quant`)", + "traefik.http.routers.quant-service.rule=PathPrefix(\"/api/quant\")", "traefik.http.routers.quant-service.entrypoints=web" ], "name": "quant-service", diff --git a/consul/config/recommend-service.json b/consul/config/recommend-service.json index 098c2cb..317ff02 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 fbbcf9c..dfbbb68 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/consul/config/whoami.json b/consul/config/whoami.json index 6d47134..93eda8c 100644 --- a/consul/config/whoami.json +++ b/consul/config/whoami.json @@ -4,7 +4,7 @@ "tags": [ "traefik.enable=true", "traefik.http.routers.whoami.entrypoints=web", - "traefik.http.routers.whoami.rule=Path(`/whoami`)", + "traefik.http.routers.whoami.rule=Path(\"/whoami\")", "traefik.http.services.whoami.loadbalancer.server.port=80" ], "address": "whoami", diff --git a/traefik/traefik.yml b/traefik/traefik.yml index 1d6a00a..473e93c 100644 --- a/traefik/traefik.yml +++ b/traefik/traefik.yml @@ -12,4 +12,4 @@ providers: api: dashboard: true insecure: true - pathPrefix: "/traefik-api" \ No newline at end of file + pathPrefixes: ["/traefik-api"] \ No newline at end of file