You can also try the stone rack-cors for sharing Cross-Origin resources. https://github.com/cyu/rack-cors
I used this gem in a Rails 4 application when my beautiful font icons wonβt appear when I start using subdomains. This wiki set me on the right path: https://github.com/bokmann/font-awesome-rails/wiki/CORS-Cross-Domain-Support
Besides changing my Gemfile, I also put the following code in config/application.rb at the beginning according to this guide: https://github.com/cyu/rack-cors/blob/master/examples/rails4/config/application. rb
config.middleware.insert_before 0, "Rack::Cors", :debug => true, :logger => (-> { Rails.logger }) do allow do origins '*' resource '/cors', :headers => :any, :methods => [:post], :max_age => 0 resource '*', :headers => :any, :methods => [:get, :post, :delete, :put, :patch, :options, :head], :max_age => 0 end end
source share