I was asked this solution a couple of times, so I thought I would post what worked for us here.
, Rails CORS CSS JS. , - . config/application.rb:
config.middleware.insert_before 0, "Rack::Cors" do
allow do
origins '*'
resource '/assets/*', :headers => :any, :methods => [:get, :options]
end
end
CORS , /assets ( ) โโ config/environments/production.rb:
config.assets.prefix = "/assets"
AWS CloudFront, @Cfstat , AWS CloudFront, . Allowed HTTP Methods, GET OPTIONS.
, , - AWF CloudFront. , config/environments/production.rb:
config.action_controller.asset_host = "//#{ENV['ASSET_HOST']}"
ASSET_HOST env, URL- CloudFront.