I am using Elastic Beanstalk and searching for an in-code solution to increasing user file upload max size. Right now I get "413 Request Entity too large if I try" to upload say a picture of 10+MB. Nginx as a proxy server is automatically denying the request. I am using Amazon Linux 2 as the OS.
SSH solutions will not work for me as EC2 instances may go down at any point and redeploy without this file (storage is ephermal) which is bad for my users.
The solutions provided here do not seem to work for .NET Core either, with the mix of config and conf files. One comment mentioned that I could try updating the web .config file and so I did, placing it inside /.platform/ with the content:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<bindings>
<basicHttpBinding>
<binding maxBufferPoolSize="2147483647"
maxBufferSize="2147483647" maxReceivedMessageSize="2147483647" transferMode="Streamed">
<readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647"
maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
<security mode="TransportCredentialOnly">
<transport clientCredentialType="Ntlm" />
</security>
</binding>
</basicHttpBinding>
</bindings>
</configuration>
But this does not have any effect on the upload limit.
I have also tried adding a .sh script in .platform/hooks/postdeploy, hoping to modify instance after deployment with:
#!/bin/bash
sudo echo "client_max_body_size 100M;" > /etc/nginx/conf.d/proxy.conf
sudo nginx service restart
But this causes the deployment to fail with "exec format error", changing the shebang to #!/bin/sh
or #!/usr/bin/bash
did not help either.
Does anyone know what I can do to increase file size limits with .NET Core, or make Amazon Linux 2 accept bash scripts?