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,
Issue
I made a call to the custom domain,
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
, and Content-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!
Quick answer: add header Accept-Encoding:identity
I had the exact same problem when using AWS api-gateway. In my case the solution was to add header Accept-Encoding:identity
either from postman or configure the AWS API to send it to my backend by default.
When I call my backend directly from postman I can set the header to gzip
and postman will display the response correctly, but when I do it through AWS it seems to be an issue that I haven't been able to address. Setting the mentioned header to Identity
will instruct the backend to don't modify the response (or apply the identity function).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With