Zuul网关

配置文件

server:
  port: 80
spring:
  application:
    name: zuul

eureka:
  instance:
    hostname: localhost
    prefer-ip-address: true
  client:
    serviceUrl:
      defaultZone: http://${eureka.instance.hostname}:8761/eureka/
zuul:
  routes:
    util:
      path: /hello/**
      serviceId: EUREKACLIENT
    search:
      path: /**
      url: https://cn.bing.com/

routes 路由 serviceId 映射到微服务 url 映射到指定URL

依赖

  <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-starter-netflix-zuul</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>
Last Updated:
Contributors: himcs