Zuul and Spring Cloud Gateway – Config file

zuul:

zuul:
  routes:
    demo:
      sensitiveHeaders: Access-Control-Allow-Origin,Access-Control-Allow-Methods    
      path: /demo/**
      stripPrefix: true
      url: http://demo.com.cn/

S-C gateway:

spring:
  cloud:
    gateway:
      default-filters:
      - AddResponseHeader=X-Response-Default-Foo, Default-Bar
      routes:
      - id: demo
        uri: http://demo.com.cn:80
        order: 8999 ## 越小越优先
        predicates: 
        - Path=/demo/**
        filters:
        - StripPrefix=1

Reference:

    1. spring cloud gateway的stripPrefix配置

    2. StripPrefix GatewayFilter Factory

猜你喜欢

转载自www.cnblogs.com/xiaobin-hlj80/p/9890894.html