fix(consul): 添加Traefik中间件以剥离/api/data前缀

添加stripprefix中间件配置,确保请求路由到data-service时剥离/api/data前缀,避免路径不匹配问题
This commit is contained in:
fanfpy 2025-07-06 12:28:20 +08:00
parent de5d14befb
commit 5af50cc066

View File

@ -10,7 +10,9 @@
"tags": [ "tags": [
"traefik.enable=true", "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" "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", "name": "data-service",
"port": 8000 "port": 8000