0

I have integrated API gateway with S3 to serve audio files. I want to download it using HTTP endpoint exposed from API Gateway and that's where the audio file is getting corrupted (though serves text file properly). Actual file is 2.9 MB and when I send REST request, res returns file(bin file) having size more than 5 MB. Can anyone help me to fix it?

1 Answers1

0

This is answered here. AWS Api Gateway as a HTTP Proxy is currupting binary uploaded image files

However,with slight changes, this is what worked for me:

  1. In HTTP request, attach the headers as shown.

curl --location --request GET 'https://GATEWAY_URL/pic.jpg' \ --header 'Content-Type: multipart/form-data' \ --header 'Content-Disposition: form-data; name="file"; filename="rahul.jpg"'

  1. In API Gateway settings, add Binary Media Types.

    image/jpeg audio/mpeg multipart/form-data

enter image description here