网关的路径解析和负载均衡

路径解析

1.指定路径
server:
  port: 8088

spring:
  application:
    name: GATEWAY
  cloud:
    consul:
      host: localhost
      port: 8500
    gateway:
      routes:
        - id: category_route							# 指定路由唯一标识
          uri: http://localhost:8085 # 指定路由服务的地址
          predicates:
            - Path=/category,/list				  # 指定路由规则

        - id: product_route
          uri: http://localhost:8084
          predicates:
            - Path=/product,/list

2.通配符
server:
  port: 8088

spring:
  application:
    name: GATEWAY
  cloud:
    consul:
      host: localhost
      port: 8500
    gateway:
      routes:
        - id: category_route							# 指定路由唯一标识
          uri: http://localhost:8085 # 指定路由服务的地址
          predicates:
            - Path=/category/**					  # 指定路由规则

        - id: product_route
          uri: http://localhost:8084
          predicates:
            - Path=/product/**

负载均衡

server:
  port: 8088

spring:
  application:
    name: GATEWAY
  cloud:
    consul:
      host: localhost
      port: 8500
    gateway:
      routes:
        - id: category_route		# 指定路由唯一标识
          uri: lb://CATEGORY   # 指定路由服务的地址
          predicates:
            - Path=/category		 # 指定路由规则

        - id: product_route
          uri: lb://PRODUCT    #默认轮询的方式  lb => loadbalance  格式: lb://服务名
          predicates:
            - Path=/product

上一篇:DVWA:介绍、环境搭建及全等级暴力破解


下一篇:DVWA(一):关于DVWA的基本介绍以及Brute Force(暴力破解)使用