I am currently using AWS API Gateway in combination with a lambda invocation. This is working perfectly, as long as I stay withing the known AWS Lambda Limits. One of the calls receives a file via a POST request, so that goes fine as long as the file is < 6 MB.
However when the file is too large, I get a 502 Bad Gateway response. This is not really helpful to the client, I would rather return a 413 Payload Too Large. How can I do this? I haven't found a way so far, looking at the API Gateway options.