The article directories

    • Static Url Routing
    • Static server list routing
    • Dynamic routing

Static Url Routing

path+url

zuul:
  routes:
    laker:
      path: /laker/**
      url: http://localhost:8080
Copy the code

Path is an Ant style expression, so /laker/* matches only one level of directory, while /laker/* can match any level of directory.

Simple URL routing will not be performed as HystrixCommand, nor will it use the Ribbon load balancing, i.e., no load balancing, failover, retry, circuit breaker functions.

The type of the PRE SimpleHostRoutingFilter. The Java

Static server list routing

Specifies the serviceId of a server list

zuul:
  routes:
    echo:
      path: /myusers/**
      serviceId: myusers-service
      stripPrefix: true

hystrix:
  command:
    myusers-service:
      execution:
        isolation:
          thread:
            timeoutInMilliseconds: .

myusers-service:
  ribbon:
    NIWSServerListClassName: com.netflix.loadbalancer.ConfigurationBasedServerList
    listOfServers: https://example1.com,http://example2.com
    ConnectTimeout: 1000
    ReadTimeout: 3000
    MaxTotalHttpConnections: 500
    MaxConnectionsPerHost: 100
Copy the code

Another approach is to specify a service route and configure the Ribbon client for serviceId (this requires disabling Eureka in the Ribbon).

zuul:
  routes:
    users:
      path: /myusers/**
      serviceId: users

ribbon:
  eureka:
    enabled: false

users:
  ribbon:
    listOfServers: example.com,google.com
Copy the code

Dynamic routing

Use with a registry, such as Eureka or NACOS

zuul:
  routes:
    myroutes1:
      path: /myusers/**
      serviceId: users
eureka:
  client:
    serviceUrl:
      defaultZne:xxx
Copy the code

Keep warm together and make progress together

🍎QQ group [837324215] 🍎 pay attention to my public number [Java Factory interview officer], learn together 🍎🍎🍎 🍎 personal vx [Lakernote]