zoukankan      html  css  js  c++  java
  • zuul中的prefix 和 strip-prefix

    • prefix :前缀,当请求匹配前缀时会进行代理。
    • strip-prefix :代理前缀默认会从请求路径中移除,通过该设置关闭移除功能。

    stripPrefix=true 时

      默认配置,转发时会自动移除前缀;

    zuul:
      routes:
        api: # 路由别名,自定义即可无其他意义
          stripPrefix: true    #会将path中的前缀去除掉
          serviceId: server-api
          path: /api/**

    当外部请求为 http://localhost:9000/api/getTest 时,通过网关转发路径为:http://localhost:9000/getTest?productId=20 

    stripPrefix=false 时

    转发时不会移除前缀;

    zuul:
      routes:
        api: # 路由别名,自定义即可无其他意义
          stripPrefix: false    #会将path中的前缀不会去除掉
          serviceId: server-api
          path: /api/**
    

    当外部请求为 http://localhost:9000/api/getTest 时,通过网关转发路径为:http://localhost:9000/getTest?productId=20  

  • 相关阅读:
    POJ 2774 Long Long Message
    Jmeter学习——5
    Jmeter学习——4
    Jmeter学习——10
    Jmeter学习——9
    使用 JMeter 完成常用的压力测试 [转]
    Jmeter学习——3
    Jmeter学习——7
    Jmeter学习——11
    Jmeter学习——8
  • 原文地址:https://www.cnblogs.com/tongxuping/p/12626464.html
Copyright © 2011-2022 走看看