API Gateway [message Not Found]

0

Hi there,

I have API Gateway with HTTP integration pointing to an external webservice. Currently, we can hit the webservice directly by using its IP address to retrieve various json files. Sample requests are: http://xxx.xxx.xxx.xxx/req.json http://xxx.xxx.xxx.xxx/req2.json http://xxx.xxx.xxx.xxx/req3.json

However, when we try to hit the API Gateway, we get {"message":"Not Found"} When we looked at the internal logs of the webservice, we noticed that requests from the API Gateway aren't hitting our webservice. We don't have any restrictions on the firewall as we're using the same endpoint for other services hosted in Azure.

Can you please advise what could be the problem?

3개 답변
4
수락된 답변

Hi, since you didn't create any stage, that means that you're the default stage '$default'. The route that you configured isn't correct and you need to set the route to $default and add the integration to your webservice endpoint like http://webservice_url

To rectify this, first delete all the existing routes and then follow these steps:

  1. Go to your API Gateway and select Route
  2. Click Create
  3. Leave the Any method as is and type in the path $default without a leading slash.
  4. Click on Attach integration and select your webservice endpoint

Eventually, this is how it should look like:

Routes:

Enter image description here

Integrations:

Enter image description here

profile pictureAWS
mml
답변함 일 년 전
profile pictureAWS
전문가
검토됨 일 년 전
0

Hi,

{"message":"Not Found"} is technically an HTTP 404 status code. It looks like the API Gateway routing isn't set correctly, meaning that you're trying to fetch an item that doesn't exist in the requested path or you're using incorrect path in the requested URL.

Can you provide some details on what the API gateway routing and stages look like?

Also what's the URL path that you're using when hitting the API gateway?

profile pictureAWS
mml
답변함 일 년 전
  • Hello

    When we created the API Gateway we didn't specify any stage. It was left to AWS to decide which stage to be used.

    As for routes, we tried using the following and none of them worked.

    / GET / ANY {proxy+}

    the URL that we're using on our clients is:

    https://api_gateway_url/req11.json

    In our testing we used Postman and Curl and both are showing the same result.

0
  • This can also happen if you have "Default endpoint" set to Disabled and are not using a custom domain to access the API. Disabled default endpoint
  • I also later had this happen from my backend rerouting to add an ending slash to my route and API Gateway treating that as a separate endpoint... This was hard to notice it was even happening. Best fix for me was to stop the reroute on my backend.
답변함 2달 전

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠