【问题标题】:Unexpected 404 using Mule 3.6 HTTP Connector使用 Mule 3.6 HTTP 连接器的意外 404
【发布时间】:2023-03-10 22:56:01
【问题描述】:

我在使用新的 HTTP 连接器时遇到了意外的 404 错误,不知道为什么。

这个 curl 发出了与我尝试相同的调用,并且按预期工作:

curl -H "X-AuntBertha-Signature: AUTH_SIG" \
    https://searchbertha-hrd.appspot.com/_ah/api/search/v1/programs/4818166?api_key=MY_API_KEY \
    > resources_dump.json

但是,此流程不起作用。供应商告诉我,他们甚至没有看到请求出现在他们的日志中,所以有些东西很时髦。

<http:request-config name="AuntBertha_Production"  host="searchbertha-hrd.appspot.com" basePath="/_ah/api/search/v1/" doc:name="HTTP Request Configuration" port="443" protocol="HTTPS" />
<!-- clipped... -->

<flow name="FetchResource">
    <!-- clipped... -->

    <http:request config-ref="AuntBertha_Production" path="/programs/4818166" method="GET" doc:name="Fetch from AB">
        <http:request-builder>
            <http:query-param paramName="api_key" value="MY_API_KEY"/>
            <http:header headerName="X-AuntBertha-Signature" value="AUTH_SIG"/>
        </http:request-builder>
        <http:success-status-code-validator values="200,404,500"/>
    </http:request>

这是我在控制台中获得的日志(在this question 的帮助下):

DEBUG 2015-07-14 16:19:55,202 [[resource_bulk_upload].HTTP_Default_Listener.worker.01] com.ning.http.client.providers.grizzly.GrizzlyConnectionsPool: [poll] Found pooled connection [TCPNIOConnection{localSocketAddress={/192.168.0.2:49878}, peerSocketAddress={searchbertha-hrd.appspot.com/209.85.147.141:443}}] for uri [https://searchbertha-hrd.appspot.com:443].
DEBUG 2015-07-14 16:19:55,203 [[resource_bulk_upload].HTTP_Default_Listener.worker.01] com.ning.http.client.providers.grizzly.GrizzlyAsyncHttpProvider: REQUEST: HttpRequestPacket (
   method=GET
   url=/_ah/api/search/v1/programs/4818166
   query=api_key=MY_API_KEY
   protocol=HTTP/1.1
   content-length=-1
   headers=[
      Host=searchbertha-hrd.appspot.com:443
      X-AuntBertha-Signature=AUTH_SIG
      Connection=keep-alive
      Accept=*/*
      User-Agent=NING/1.0]
)
DEBUG 2015-07-14 16:19:55,262 [[resource_bulk_upload].http.requester.AuntBertha_Production(3) SelectorRunner] com.ning.http.client.providers.grizzly.GrizzlyAsyncHttpProvider: RESPONSE: HttpResponsePacket (
  status=404
  reason=Not Found
  protocol=HTTP/1.1
  content-length=-1
  committed=false
  headers=[
      cache-control=no-cache, no-store, max-age=0, must-revalidate
      pragma=no-cache
      expires=Fri, 01 Jan 1990 00:00:00 GMT
      date=Tue, 14 Jul 2015 21:19:49 GMT
      vary=X-Origin
      content-type=text/html; charset=UTF-8
      x-content-type-options=nosniff
      x-frame-options=SAMEORIGIN
      x-xss-protection=1; mode=block
      server=GSE
      alternate-protocol=443:quic,p=1
      accept-ranges=none
      transfer-encoding=chunked]
)

如果我将请求更改为 ping,例如google.com 相反,它按预期工作。我在这里想念什么?我工作的curl 和坏掉的&lt;flow&gt; 有什么不匹配?

【问题讨论】:

  • 我看到服务拒绝使用404 对他们认为是机器人的用户代理的请求。在这里,Mule 的用户代理是 NING/1.0:您可以尝试使用 curl-H "User-Agent: Mozilla/5.0 (Windows NT 6.3; rv:36.0) Gecko/20100101 Firefox/36.0" 看看是否可以从命令行重现问题吗?

标签: mule


【解决方案1】:

404 not found 意味着它确实连接到某个地方并得到了 404 响应。

所以从网络的角度来看,您的通话实际上是成功的。

所以代码基本上可以工作。可能是 David 建议的 Header 问题,例如用户代理错误或 IP/域调用错误,或者执行请求的 Mule 节点具有一些自定义代理配置或类似配置。但是你的“代码不起作用”的说法,我不确定,代码实际上是有效的,看来配置是什么不起作用。

【讨论】:

  • 对 - 问题是 - 它连接到哪里,为什么会得到 404 响应?它确实 not 似乎连接到https://searchbertha-hrd.appspot.com/_ah/api/search/v1/programs/4818166?api_key=MY_API_KEY - 这是我根据配置所期望的。但我无法弄清楚它连接到什么或如何修复它。
猜你喜欢
  • 2015-08-29
  • 1970-01-01
  • 1970-01-01
  • 2015-06-08
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多