AriStockAI/consul/config/dev/emotion-service.json
fanfpy 1819c9e111 refactor(consul): 将主机路由规则改为路径前缀并添加中间件
修改所有服务的路由规则,从基于主机名改为基于路径前缀
为每个服务添加strip前缀中间件以正确处理API请求
2025-07-15 18:55:50 +08:00

20 lines
700 B
JSON

{
"service": {
"address": "emotion-service",
"check": {
"http": "http://emotion-service:8002/health",
"interval": "10s",
"timeout": "5s"
},
"id": "emotion-service-1",
"tags": [
"traefik.enable=true",
"traefik.http.routers.emotion-service.rule=PathPrefix(`/api/emotion`) || PathPrefix(`/api/sentiment`)",
"traefik.http.routers.emotion-service.entrypoints=web",
"traefik.http.middlewares.emotion-service-stripprefix.stripprefix.prefixes=/api/emotion,/api/sentiment",
"traefik.http.routers.emotion-service.middlewares=emotion-service-stripprefix@consulcatalog"
],
"name": "emotion-service",
"port": 8002
}
}