'Uploading zip file through API Gateway (proxying to ECS) results in corrupted zip file

I have an AWS API Gateway proxying through a VPC into an docker hosted on ECS. No other settings have been done on the API Gateway level. Whenever I upload a zip file and then try to download it it's corrupted. Works fine with things like images etc.

Example headers for zip file upload

accept: application/json, text/plain, */*
accept-encoding: gzip, deflate, br
accept-language: en-US,en;q=0.9,el-GR;q=0.8,el;q=0.7
content-length: 482408
content-type: multipart/form-data; boundary=----WebKitFormBoundaryrAyZqb4A6jKc1VBA

The code running in the Docker container works fine. Whenever I try to upload directly i.e. without passing through the API Gateway, then it works fine.

Any ideas are welcome.

Thanks

Method Request Api Gateway Integration Request



Solution 1:[1]

I had the same issue and it turned out I was sending the request without all needed headers. It worked fine with Postman. Please check if your request contains these headers. postman headers

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 John_IV