jquery

gist JS

Thursday, September 11, 2014

CORS for Rails / Heroku & Cloudfront (for dummies)

So starting today all your fonts don't load. Because CORS.

No 'Access-Control-Allow-Origin' header is present on the requested resource.

Here's what to do.

1) Remember your CloudFront password.


2) Edit your behavior

 

3) Forwarding headers -> whitelist



4) Add "Origin"

5) Add rack-cors to Gemfile

gem 'rack-cors'


6) Add stuff to config.ru

require 'rack/cors'
use Rack::Cors do

  # allow all origins in development
  allow do
    origins '*'
    resource '*',
        :headers => :any,
        :methods => [:get, :post, :delete, :put, :options]
  end
end

7) Deploy


8) Try to forget about CORS


Did that work? Why not try my tool ForceRank.it, a prioritization tool for product teams that lets you rank choices. It even lets you import a Trello board!

1 comment:

sunitha vishnu said...



This is excellent information. It is amazing and wonderful to visit your site.Thanks for sharing this information,this is useful to me...
Android Training in Chennai
Ios Training in Chennai