I prepare flutter client application for iOS/Android. When I send video (or something larger than 10mb) nginx return error 413 "Request Entity Too Large". My request looks like this: https://dev.to/carminezacc/advanced-flutter-networking-part-1-uploading-a-file-to-a-rest-api-from-flutter-using-a-multi-part-form-data-post-request-2ekm first code in this article, here is raw snippet:
(String filename, String url) async {
var request = http.MultipartRequest('POST', Uri.parse(url));
request.files.add(
http.MultipartFile(
'picture',
File(filename).readAsBytes().asStream(),
File(filename).lengthSync(),
filename: filename.split("/").last
)
);
var res = await request.send();
}
But when I try send file via Postman or custom API client, server accepts larger files without any problem. This issue occurs only in Flutter app case. I try implement file sender in Flutter in different way (using Dio
library) but result is the same: HTTP Error 413.
I do not have access to backend settings and server configuration. I know that similar issue is when nginx have wrong configuration (like this) but remember: when I try send file using Postman everything is okay and Nginx configuration does not cause problems. Any ideas how to avoid Error 413 in this case? Maybe I forgot add something to headers?