Skip to main content

Limiting filesize upload when using Shrine + AWS S3

Rails • Asked by Masud Hossain

I built my file upload using Chris's guide (https://gorails.com/series/direct-uploads-to-amazon-s3), and i'm trying to figure out a way to increase limit the upload size of each file. Right now it seems like it's set to 5MB max.

Does anyone know how to do this?


Since this never really hits your Rails app and the uploads are direct to S3, the configuration is gonna have to be on the S3 side. This post here (https://aws.amazon.com/articles/1434) talks about setting a policy where you define the content-length-range which will correctly reject the file upload if it's outside those boundaries. I'm not quite sure exactly where that goes, possibly it has to be passed into the Shrine when it generates the presign signature unless it can be defined in S3 itself (which might be possible too). Probably work posting an issue on Shrine to ask for his advice there as he'd konw more about this than I do.


Found out the problem was nginx. There's a size limitation (http://prntscr.com/fz5713) on hatch under Nginx settings, so i changeg it to 900mb and now it's uploading fine.


Login or Create An Account to join the conversation.

Subscribe to the newsletter

Join 27,623+ developers who get early access to new screencasts, articles, guides, updates, and more.

    By clicking this button, you agree to the GoRails Terms of Service and Privacy Policy.

    More of a social being? We're also on Twitter and YouTube.