S3 Direct Upload in your Rails application


Using the S3 direct upload in Rails is a nice way to give the user an indication that something is happening, whilst avoiding any timeout behaviour that is often seen in Heroku.

One hiccup to watch out for is the bucket configuration in your S3 account. When you create a bucket, the default CORS config only allows GET requests for that bucket. 

For S3 Direct Upload to work, have this as your CORS settings:


*Note, make the above better by explaining how to lock down AllowedOrigin and AllowedHeader*


Even after adding in the `PUT` and `POST` permissions, there was still a `403 error` being thrown when using the upload. The reason ended up being the allowed header, so adding:

        **Other settings
        **Other settings

worked out well. 

Contact us about our engineering and design services

Let's Talk

Contact Us