Got a Rails app on Heroku. I want to limit the size of a file upload if possible. The file is processed as a StringIO object, so the file contents will be processed in mem
You could run NGINX in front of your app server to enforce this constraint.
This is fairly simple with heroku, you will need a nginx.conf and this buildpack.
# nginx.conf
http {
#...
client_max_body_size 100m;
#...
}
Note: But be aware that on heroku, NGINX run inside your dynos (ie. local to each instance).
https://blog.codeship.com/how-to-deploy-nginx-on-heroku
Hope that's help!