Spring Cloud Zuul 路由配置
2019-03-31 本文已影响0人
歌哥居士
1.默认情况
访问:http://localhost:11000/actuator/routes
{
- /zuul-provider/**: "zuul-provider"
}
2.指定路径
application.properties
spring.application.name=zuul-gateway
server.port=11000
eureka.client.service-url.defaultZone=http://localhost:9000/eureka
# 开启actuator, 方便查看路径配置
management.endpoints.web.exposure.include=*
management.endpoint.health.show-details=always
### 配置Zuul ###
# 指定规则
zuul.routes.zuul-provider=/provider/**
{
- /provider/**: "zuul-provider",
- /zuul-provider/**: "zuul-provider"
}
3.忽略路径
application.properties
spring.application.name=zuul-gateway
server.port=11000
eureka.client.service-url.defaultZone=http://localhost:9000/eureka
# 开启actuator, 方便查看路径配置
management.endpoints.web.exposure.include=*
management.endpoint.health.show-details=always
### 配置Zuul ###
# 指定规则
zuul.routes.zuul-provider=/provider/**
# 忽略服务
zuul.ignored-services=zuul-provider
{
- /provider/**: "zuul-provider"
}
4.完整示例
application.properties
spring.application.name=zuul-gateway
server.port=11000
eureka.client.service-url.defaultZone=http://localhost:9000/eureka
# 开启actuator, 方便查看路径配置
management.endpoints.web.exposure.include=*
management.endpoint.health.show-details=always
### 配置Zuul ###
zuul.ignored-services=*
zuul.routes.zuul-provider=/provider/**
{
- /provider/**: "zuul-provider"
}