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

20 lines
688 B
JSON

{
"service": {
"address": "data-service",
"check": {
"http": "http://ari-data-service:8000/api/public/stock_bid_ask_em?symbol=000001",
"interval": "10s",
"timeout": "5s"
},
"id": "data-service-1",
"tags": [
"traefik.enable=true",
"traefik.http.routers.data-service.rule=PathPrefix(`/api/data`) || PathPrefix(`/api/public`)",
"traefik.http.routers.data-service.entrypoints=web",
"traefik.http.middlewares.data-service-stripprefix.stripprefix.prefixes=/api/data,/api/public",
"traefik.http.routers.data-service.middlewares=data-service-stripprefix@consulcatalog"
],
"name": "data-service",
"port": 8000
}
}