【发布时间】: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 和坏掉的<flow> 有什么不匹配?
【问题讨论】:
-
我看到服务拒绝使用
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