Skip to content

Instantly share code, notes, and snippets.

@cheeyeo
Last active September 16, 2015 23:38
Show Gist options
  • Save cheeyeo/198d2ea081c6f256ba3d to your computer and use it in GitHub Desktop.
Save cheeyeo/198d2ea081c6f256ba3d to your computer and use it in GitHub Desktop.
CORS Rails 4+
config.middleware.insert_before 0, "Rack::Cors", debug: true, logger: ->{Rails.logger} do
allow do
origins 'localhost:3000'
resource %r{/users\/?\d*},
:headers => ['Origin', 'Accept', 'Content-Type','Token'],
:methods => [:get, :put, :delete],
:max_age => 0
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment