spring cloud zuul

spring cloud zuul官网:http://cloud.spring.io/spring-cloud-static/spring-cloud-netflix/1.3.1.RELEASE/,具体配置不记

spring cloud zuul是配置路由的,我们配置的时候,喜欢这么配置例如:

zuul:
  routes:
    api-a:
      path: /api-a/**
      serviceId: service-A

但是其实我们不配置也是可以路由的,如果我们的api-gateway网关的开的端口是5555,有另一个服务A,service-a

如果我们不配置上面的话,我们访问服务A就是locahost:5555/service-a

如果我们配置上面的代码,我们访问服务A就是localhost:5555/api-a

其实这里我们就是把服务名称向用户隐藏了,,这种ip:port/service-Id的方式访问加了zuul的服务才能用,普通服务不能这么用

原文地址:https://www.cnblogs.com/waterlufei/p/7145887.html