StripPrefix

来自ling
跳转至: 导航搜索

这个时候要注释掉

        - id: runtimeapi
          uri: lb://runtime
#          uri: http://127.0.0.1:8080
          predicates:
            - Path=/runtimeapi/**
          filters:
            # 去掉/qa/ 比如访问url是/qa/test 经过gateway后,后面服务拿到的就只有/test
#            - StripPrefix=1

这个时候要加上,不知道为啥

        - id: runtime
          uri: lb://runtime
#          uri: http://127.0.0.1:8080
          predicates:
            - Path=/runtime/**
          filters:
            # 去掉/qa/ 比如访问url是/qa/test 经过gateway后,后面服务拿到的就只有/test
            - StripPrefix=1
spring:
  cloud:
    gateway:
      discovery:
        locator:
          enabled: true  #开启注册中心路由功能
          lower-case-service-id: true
      httpclient:
        ssl:
          useInsecureTrustManager: true
      routes:
        # runtime
        - id: runtimeapi
          uri: lb://runtime
#          uri: http://127.0.0.1:8080
          predicates:
            - Path=/runtimeapi/**
          filters:
            # 去掉/qa/ 比如访问url是/qa/test 经过gateway后,后面服务拿到的就只有/test
#            - StripPrefix=1
        # demo
        - id: kpmgisjomooapi
          uri: lb://kpmgisjomoo
          #          uri: http://127.0.0.1:8080
          predicates:
            - Path=/kpmgisjomooapi/**
          filters:
            # 去掉/qa/ 比如访问url是/qa/test 经过gateway后,后面服务拿到的就只有/test
#            - StripPrefix=1
        # cssbasicdata
        - id: cssbasicdataapi
          uri: lb://cssbasicdata
          #          uri: http://127.0.0.1:8080
          predicates:
            - Path=/cssbasicdataapi/**
          filters:
            # 去掉/qa/ 比如访问url是/qa/test 经过gateway后,后面服务拿到的就只有/test
#            - StripPrefix=1
        # cssworkorder
        - id: cssworkorderapi
          uri: lb://cssworkorder
          #          uri: http://127.0.0.1:8080
          predicates:
            - Path=/cssworkorderapi/**
          filters:
            # 去掉/qa/ 比如访问url是/qa/test 经过gateway后,后面服务拿到的就只有/test
#            - StripPrefix=1
        # cssspareparts
        - id: csssparepartsapi
          uri: lb://cssspareparts
          #          uri: http://127.0.0.1:8080
          predicates:
            - Path=/csssparepartsapi/**
          filters:
            # 去掉/qa/ 比如访问url是/qa/test 经过gateway后,后面服务拿到的就只有/test
#            - StripPrefix=1
        # cssdispatchmgt
        - id: cssdispatchmgtapi
          uri: lb://cssdispatchmgt
          #          uri: http://127.0.0.1:8080
          predicates:
            - Path=/cssdispatchmgtapi/**
          filters:
            # 去掉/qa/ 比如访问url是/qa/test 经过gateway后,后面服务拿到的就只有/test
#            - StripPrefix=1
ribbon:
  eureka:
    enabled: false
#  nacos:
#    enabled: false
### 针对单个服务的 Ribbon 配置
runtime:
  ribbon:
    listOfServers: 39.98.126.59:30001
    ServerListRefreshInterval: 15000
cssbasicdata:
  ribbon:
    listOfServers: 39.98.126.59:30002
    ServerListRefreshInterval: 15000
cssworkorder:
  ribbon:
    listOfServers: 39.98.126.59:30003
    ServerListRefreshInterval: 15000
cssspareparts:
  ribbon:
    listOfServers: 39.98.126.59:30004
    ServerListRefreshInterval: 15000
cssdispatchmgt:
  ribbon:
    listOfServers: 39.98.126.59:30005
    ServerListRefreshInterval: 15000