0
votes

I have deployed a Gateway API. When I test it from within AWS console, it works. When I test it using "Postman" (by sending Accept-Encoding:identity header), it works.

But when I test it using (Chrome) browser, it fails ... and I get this error ...

ERR_CONTENT_DECODING_FAILED

I have already added the header Accept-Encoding:identity into 'Integration Request' in the gateway API as suggested here and here. But its not making any difference.

Can someone please help ?

Any other questions, please let me know.

Thanks

2
Adding Accept-Encoding: identity is a slight hack, telling your origin server that Content-Encoding: gzip is not supported, so that Transfer-Encoding: chunked will not be engaged, since some servers switch to chunked transfer encoding when they decide gzip content. If your back-end is doing chunked encoding anyway, this will be the "real" problem. Can you capture the response headers from the origin (back-end) server? - Michael - sqlbot

2 Answers

0
votes

It was a rookie mistake .... Redeploying the API fixed the issue ...

0
votes

I too had this issue and found that it was because my API was serving compressed (gzipped) assets, and API Gateway doesn't like compressed responses unless you base64 encode the body and set base64encoded = true in the response object.

This discussion also helps: https://forums.aws.amazon.com/thread.jspa?threadID=241530