Spring Cloud Edgware新特性之四:Zuul routes端点功能增强
2017-10-27 00:00
555 查看
Spring Cloud是当前炙手可热的微服务开发框架。它的功能强大,组件丰富,设计优雅。目前Spring Cloud还在不断发展之中。
Spring Cloud即将发布Spring Cloud Edgware 版本。该版本解决了不少Bug,新增了不少新特性,本系列博客将为大家详细阐述在Spring Cloud Edgware中新增的特性。
我们知道,Zuul有一个非常实用的 /routes 端点。访问 $ZUUL_URL/routes 即可查看当前Zuul的路由规则,从而在很多情况下能够帮助我们定位Zuul的问题——当Zuul没有按照我们的计划去转发请求时,/routes 就会很有用,可通过该端点查看Zuul转发的规则。访问结果类似如下:
TIPS:使用routes 端点的前提:
Zuul Server需要有Spring Boot Actuator的依赖,否则访问/routes 端点将会返回404;。
设置management.security.enabled = false ,否则将会返回401;也可添加Spring Security的依赖,这样可通过账号、密码访问routes 端点。
/routes 端点相关文档,可详见http://cloud.spring.io/spring-cloud-static/Dalston.SR4/single/spring-cloud.html#_the_routes_endpoint 。
在Spring Cloud Edgware 中,Spring Cloud对该端点进行了增强。我们可通过/routes?format=detail 来查看更多详情。访问后,将会展示类似如下的结果:
有结果可知,此时Zuul为我们展示了很多有用的信息,例如:转发到了那个地址、是否重试等。使用/routes?format=detail 可进一步简化我们的调试与排错。
本文链接: http://www.itmuch.com/spring-cloud/edgware-zuul-routes-endpoint/
版权声明: 本博客由周立创作,采用 CC BY 3.0 CN 许可协议。可自由转载、引用,但需署名作者且注明文章出处。如转载至微信公众号,请在文末添加作者公众号二维码。
Spring Cloud即将发布Spring Cloud Edgware 版本。该版本解决了不少Bug,新增了不少新特性,本系列博客将为大家详细阐述在Spring Cloud Edgware中新增的特性。
我们知道,Zuul有一个非常实用的 /routes 端点。访问 $ZUUL_URL/routes 即可查看当前Zuul的路由规则,从而在很多情况下能够帮助我们定位Zuul的问题——当Zuul没有按照我们的计划去转发请求时,/routes 就会很有用,可通过该端点查看Zuul转发的规则。访问结果类似如下:
{ /sample-service/**: "sample-service" } // 这段JSON表示:如果请求$ZUUL_URL/sample-service/**,Zuul会将请求转发到注册在Eureka Server上的sample-service服务的/**。
TIPS:使用routes 端点的前提:
Zuul Server需要有Spring Boot Actuator的依赖,否则访问/routes 端点将会返回404;。
设置management.security.enabled = false ,否则将会返回401;也可添加Spring Security的依赖,这样可通过账号、密码访问routes 端点。
/routes 端点相关文档,可详见http://cloud.spring.io/spring-cloud-static/Dalston.SR4/single/spring-cloud.html#_the_routes_endpoint 。
在Spring Cloud Edgware 中,Spring Cloud对该端点进行了增强。我们可通过/routes?format=detail 来查看更多详情。访问后,将会展示类似如下的结果:
{ "/sample-service/**": { "id": "sample-service", "fullPath": "/sample-service/**", "location": "sample-service", "path": "/**", "prefix": "/sample-service", "retryable": false, "customSensitiveHeaders": false, "prefixStripped": true } }
有结果可知,此时Zuul为我们展示了很多有用的信息,例如:转发到了那个地址、是否重试等。使用/routes?format=detail 可进一步简化我们的调试与排错。
本文链接: http://www.itmuch.com/spring-cloud/edgware-zuul-routes-endpoint/
版权声明: 本博客由周立创作,采用 CC BY 3.0 CN 许可协议。可自由转载、引用,但需署名作者且注明文章出处。如转载至微信公众号,请在文末添加作者公众号二维码。
相关文章推荐
- Spring Cloud Edgware新特性之五:filters端点
- Spring Cloud Edgware新特性:Zuul回退的改进
- Spring Cloud Edgware新特性之八:Zuul回退的改进
- Spring Cloud Edgware新特性之二:如何配置Zuul的Hystrix线程池
- Spring Cloud Edgware新特性
- Spring Cloud Zuul 在版本Edgware.RELEASE断路超时配置无法生效问题
- Spring Cloud Edgware新特性全接触
- Spring Cloud Edgware新特性之九:Sleuth使用MQ方式整合Zipkin
- Spring Cloud Edgware新特性全接触
- Spring Cloud Edgware新特性之六:Artifact ID变更
- Spring Cloud Edgware新特性之七:可选的EnableDiscoveryClient注解
- Spring Cloud Edgware新特性之三:使用配置属性自定义Feign的行为
- SpringCloud系列:利用Zuul实现统一服务网关服务,简单实现IP白名单功能
- Spring Cloud Edgware新特性之一:解决Eureka中Jersey 1.x版本过旧的问题-不使用Jersey
- SpringCloud系列八:Zuul 路由访问(Zuul 的基本使用、Zuul 路由功能、zuul 过滤访问、Zuul 服务降级)
- Spring Boot 2.0新增的Actuator端点的特性
- spring cloud 学习(6) - zuul 微服务网关
- Spring Cloud:Eureka,Zuul和OAuth2 - 扩展授权服务器
- 【Spring Cloud】Zuul 路由访问
- Spring4.1新特性——静态资源处理增强