Skip to main content

Set up S3 or DO Spaces for storage, and serve stored images through Cloudfront or other CDN

Rails • Asked by Ken
Hi all, I'm trying to set up a Rails 5.2 app to directly upload images to Digital Ocean Spaces, and to then serve those images using Cloudfront. I'm able to do direct uploads to Spaces using ActiveStorage following #237, and I've configured Cloudfront as my asset host and everything in app/assets is served from there. But I can't figure out how to get the CDN to serve my images stored on Spaces. I tried nukeproof's workaround here: https://github.com/rails/rails/issues/31419 without success. Any suggestions?

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.