New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ActiveStorage Feature Request - Support for CDN (Cloudfront) #35926
Comments
Thank you so much for the issue but we don't take feature request on the issue tracker. We recommend you to try to implement the feature and send us a pull request or if you are in doubt if the feature will be accepts ask in Rails Core mailing list for feedback. |
Any updates on this with Rails 6? We also want to use Cloudfront in front of S3, as recommended by Amazon. |
Here's my final solution: Basically for now I use |
Every once in awhile I come back to check on "ActiveStorage CDN support" and google always finds this rails issue. Active development on this can be found here. #34477 |
update as @joshuacronemeyer recommends in comment bellow https://edgeguides.rubyonrails.org/active_storage_overview.html#putting-a-cdn-in-front-of-active-storage is much better solution TL;DR I've summed up the CDN solution in https://blog.eq8.eu/til/rails-active-storage-cdn.html related |
@equivalent Rails active storage docs have a section on using a CDN. https://edgeguides.rubyonrails.org/active_storage_overview.html#putting-a-cdn-in-front-of-active-storage It's probably better to look there. |
See: #42305 |
Hello Rails team,
**Disclaimer: this is my first Github issue, so apologies if I'm missing something.
I've spent a fair amount of time researching and trialing how to setup Active Storage to leverage Cloudfront. There are a number of issues like:
And even some pieces on other projects:
But can't seem to find a clear solution, or one sanctioned from Rails/Active Storage itself, so I believe this is still a bug. I'm looking for confirmation that this will be resolved in Rails 6 release (hopefully), or feedback from the team. Thanks!
Steps to reproduce
Setup basic rails project with Active storage. Set asset host to Cloudfront CDN (tried pointing CDN to S3 and project, or simply back to project itself). Unfortunately, Active Storage ignores asset_host and pulls directly from S3 regardless.
Expected behavior
When using a CDN to host files for site, specifically those user uploaded through Active Storage, Active Storage should run requests through CDN first when making download requests. Uploads should be through Active Storage current pathways, but once asset_host is set, downloads should flow through CDN.
Actual behavior
Currently, everything flows through Active Storage when trying to download/retrieve blobs, resulting in slow load times
System configuration
Rails version: 5.2.2
Ruby version: 2.5.1
The text was updated successfully, but these errors were encountered: