问题
I'm getting unexpected 404 errors using the new HTTP connector and can't figure out why.
This curl makes the same call I'm trying to make, and works as expected:
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
However, this flow does NOT working. Vendor told me that they don't even see the request show up in their logs, so something is funky.
<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>
And here are the logs I'm getting in my console (after help from 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]
)
If I change the request to ping e.g. google.com instead, it works as expected. What am I missing here? What's the mismatch between my working curl
and broken <flow>
?
回答1:
404 not found means it did connect somewhere and got a 404 response back.
So your call is actually successful from a network perspective.
So the code basically works. It could be either like David suggested a Header issue, like user-agent is wrong or the IP/domain calling is wrong, or the Mule node executing the request has some custom proxy configuration or similar. But your statement of "code does not work", I am not sure, the code actually works, it seems the configuration is what does not work.
来源:https://stackoverflow.com/questions/31417797/unexpected-404-using-mule-3-6-http-connector