首页 文章

Zuul代理背后的 Spring 天

提问于
浏览
2

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

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

Zuul路由在网关配置:

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 .

1 回答

  • 1

    在默认情况下转发请求之前,Zuul实际上会从请求中删除代理前缀 . 对于单个服务,您可以使用 stripPrefix=false 关闭此行为 . 如果你想要所有的航线,那么 zuul.stripPrefix=false

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

    希望这能解决您的问题 .

相关问题