【问题标题】:spring-ws behind a Zuul proxyZuul 代理背后的 spring-ws
【发布时间】:2016-12-19 16:47:12
【问题描述】:

我有一个使用 spring-WS 实现 WSDL 的微服务(spring-boot)。 计划是使用 Zuul 通过网关服务器访问 WSDL。

从网关访问:http://192.168.1.5:8080/integration/ws/test.wsdl

Zuul路由配置在Gateway:

integration:
  sensitive-headers:
  path: /integration/**
  url: http://localhost:9090

返回的 WSDL 带有正确的端口号 (8080) 但不正确的主机名。也不返回前缀“/integration”。

<wsdl:service name="TestPortService">
    <wsdl:port binding="tns:TestPortSoap11" name="TestPortSoap11">
         <soap:address location="http://localhost:8080/ws"/>
    </wsdl:port>
</wsdl:service>

即使我手动设置 X-Forwarded-For 标头,主机名似乎也不会改变。 [这个我在没有 Zuul 的情况下测试]。为了让 Spring-WS 在代理后面工作,我缺少什么?我在 Spring Boot 的应用程序属性中设置了 remote_ip_header 和 protocol_header。

【问题讨论】:

    标签: spring-boot spring-ws netflix-zuul


    【解决方案1】:

    Zuul 实际上是在默认转发请求之前从请求中剥离代理前缀。您可以使用stripPrefix=false 关闭此行为,如下面的个别服务。如果你想要所有路由,那么zuul.stripPrefix=false

    application.yml
     zuul:
      routes:
        users:
          path: /myusers/**
          stripPrefix: false
    

    希望这能解决您的问题。

    【讨论】:

      猜你喜欢
      • 2015-07-31
      • 2016-07-06
      • 2015-05-23
      • 2016-03-09
      • 2016-04-13
      • 2015-11-28
      • 2017-04-24
      • 2016-05-28
      • 1970-01-01
      相关资源
      最近更新 更多