Problem:
AWS API Gateway Proxy is not passing back the response from my backend service when using Postman, but works on curl
Description:
I have a backend service that I want to exposed via AWS API gateway. The use of gateway in this case is purely as a HTTP proxy. So,
- Created a new API
- Set the Resource as "Proxy" using ANY
- Gave my backend service address
- Deployed it (No Auth required, but API Key is needed though)
- Could call my backend service from the deployment stage url successfully
- Create a custom domain using a CA cert
- Created an Alias on my DNS provider
- 1hr later the Domain is up and working pointing to the cloudfront
Issue
I made a call to the custom domain,
- API gateway received it
- Call is logged in the cloudwatch logs, and
- It is hitting my Backend.
- Backend replied to API gateway.
But, on my postman, I see a "Could not get any response"
However, If I try this via curl
, I am getting the intended response back that was sent by my backend. So, the unclear part is -
What is wrong with Postman call or a normal browser url bar based GET to my endpoint?
Why is curl successful?
and, for my API Gateway endpoint, I have set API Key as mandatory. I have created an API key and assigned it to the API. Interesting part is that, the curl call is still successful even if I do not pass an API Key. Why could API Gateway allow such calls ?
Another confusing issue for me is, I have to pass custom values in the
Accept
, andContent-Type
that I use for my API versioning.
Ex: Accept: application/json-v1
is failing but Accept: application/xml-v1
is working.
I think this is something to do with value as API Gateway is not liking it.
I have read through the docs thoroughly and still could not find any reasonable explanation for all these issues. What am I missing that is causing these weird bag of issues ? My google fu so far too was not enough to solve this.
Please help or equally point me to the specific docs in AWS gateway that can help solve this or any discussion threads that I may have missed on these topics.
At least getting an answer for one of these will give me a clarity on my approach.
thanks people!