123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354 |
- # 服务端口
- server:
- port: 4000
- # 应用名
- spring:
- application:
- name: app-gateway
- # 使用 consul 作为配置中心
- profiles:
- active: test
- config:
- import: "consul:"
- cloud:
- # consul 服务注册
- # 如需要查看 Web UI: http://localhost:8500/ui/
- consul:
- host: 127.0.0.1
- port: 8500
- # discovery
- discovery:
- enabled: true
- prefer-ip-address: true
- instance-id: ${spring.application.name}:${spring.cloud.client.ip-address}:${server.port}
- # config
- config:
- enabled: true
- format: yaml
- data-key: data
- gateway:
- mvc:
- routes: # 路由配置
- - id: api-location
- uri: lb://api-location
- predicates:
- - Path=/api/*/locatectx/**
- - id: api-user
- uri: lb://api-user
- predicates:
- - Path=/api/*/userctx/**
- - id: api-message
- uri: lb://api-message
- predicates:
- - Path=/api/*/messagectx/**
- # Spring Cloud Gateway 不支持 WebSocket
- # api-websocket 请在上衣层中间件转发,例如 Nginx
- - id: api-websocket
- uri: lb://api-websocket
- predicates:
- - Path=/api/*/gatewayctx/**
- management:
- endpoints:
- web:
- exposure:
- include: "*"
|