Add Access-Control support to ActionDispatch::Static

Hi,

Has anyone thought about adding Access-Control headers for assets? Right now, I use asset_sync gem to send all assets to an S3 bucket after asset:precompile and use CloudFront to serve them, where the 3S bucket has Access-Control settings.

But if ActionDispatch::Static automatically (or with a proper config) puts the Access-Control headers for us, then there is no need to set it up and we can just change CloudFront to point directly to the Rails app.

Let me know what you think. Thanks for your time!

Thanks,

Yuki

I’m pro letting people configure arbitrary headers for serving assets. I think we should bake support for this in Rails.

On a side note I really dislike asset_sync

https://gist.github.com/schneems/9374188

I’ve sent a pull request a few hours ago: https://github.com/rails/rails/pull/19135
I’m totally open to suggestions, as I still think both the implementation and API could be better.