当followRedirects=false时,Mule ESB HTTP重定向不起作用

当followRedirects=false时,Mule ESB HTTP重定向不起作用,mule,mule-studio,Mule,Mule Studio,我有一个简单的流程对mule不起作用。在我的设置中,我在一个端口上侦听HTTP流量,并在另一个端口上转发流量,我认为这是最典型的ESB用例。代理/网关流工作,除非目标应用程序发出重定向。有人知道解决这个问题的窍门吗?请注意,我不能使用mule的HTTP代理模式,因为我打算扩展此流以用于更复杂的用例 骡流 响应记录案例2 我认为问题在于您没有将属性从请求者复制到侦听器的响应。我建议在请求者之后使用copyproperties元素。否则,入站属性将丢失:此时您需要它们作为出站。 但是,某些属性(如h

我有一个简单的流程对mule不起作用。在我的设置中,我在一个端口上侦听HTTP流量,并在另一个端口上转发流量,我认为这是最典型的ESB用例。代理/网关流工作,除非目标应用程序发出重定向。有人知道解决这个问题的窍门吗?请注意,我不能使用mule的HTTP代理模式,因为我打算扩展此流以用于更复杂的用例

骡流

响应记录案例2


我认为问题在于您没有将属性从请求者复制到侦听器的响应。我建议在请求者之后使用copyproperties元素。否则,入站属性将丢失:此时您需要它们作为出站。 但是,某些属性(如http.status)可能需要使用响应生成器显式映射到头。
HTH

我添加了这两个变压器以使其工作。我还有一个问题。Mule在调用http:request时总是删除主机头。因此,目标服务器没有在正确的位置发送重定向。有没有办法,我可以指示Mule使用原始主机头?是的,您应该使用请求生成器,并使用MEL表达式将其添加为头,以从请求中获取头。我添加了这个,最后它成功了。谢谢你的帮助
<http:listener-config name=“HTTP_IN" host=“localhost" port="12344" doc:name=“IN_EP" />
<http:request-config name=“HTTP_OUT" host=“localhost" port="8380" doc:name=“OUT_EP"/>
<flow name="test2Flow2">
    <http:listener config-ref=“HTTP_IN" path="*" doc:name="IN"/>
    <logger level="INFO" doc:name="Request Logger"/>
    <http:request config-ref=“HTTP_OUT" path="#[message.inboundProperties.'http.request.path']" method="#[message.inboundProperties.'http.method']" doc:name="OUT" followRedirects="false" />
    <response>
        <logger level="INFO" doc:name="Response Logger"/>
    </response>
</flow>
INFO  2015-10-01 13:01:48,333 [[test2].APP_A_IN.worker.01] org.mule.api.processor.LoggerMessageProcessor: 
org.mule.DefaultMuleMessage
{
Message properties:
  INVOCATION scoped properties:
  INBOUND scoped properties:
    accept=text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
    accept-encoding=gzip, deflate, sdch
    accept-language=en-US,en;q=0.8
    cache-control=max-age=0
    connection=keep-alive
    dnt=1
    host=localhost:12344
    http.listener.path=/*
    http.method=GET
    http.query.params=ParameterMap{[]}
    http.query.string=
    http.relative.path=/app_a
    http.remote.address=/127.0.0.1:53372
    http.request.path=/app_a
    http.request.uri=/app_a
    http.scheme=http
    http.uri.params=ParameterMap{[]}
    http.version=HTTP/1.1
    upgrade-insecure-requests=1
    user-agent=Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.101 Safari/537.36
    x-firephp-version=0.0.6
  OUTBOUND scoped properties:
  SESSION scoped properties:
}
INFO  2015-10-01 13:01:48,420 [[test2].APP_A_IN.worker.01] org.mule.api.processor.LoggerMessageProcessor: 
org.mule.DefaultMuleMessage
{

Message properties:
  INVOCATION scoped properties:
  INBOUND scoped properties:
    date=Thu, 01 Oct 2015 17:01:48 GMT
    http.reason=Moved Temporarily
    http.status=302
    location=http://localhost:8380/app_a/
    server=Apache-Coyote/1.1
    transfer-encoding=chunked
  OUTBOUND scoped properties:
  SESSION scoped properties:
}