Skip to content

Commit

Permalink
Support CORS with rack-cors
Browse files Browse the repository at this point in the history
  • Loading branch information
kumabook committed Dec 29, 2017
1 parent 2afa4ae commit b3f0570
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions config/application.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,11 @@ class Application < Rails::Application
# Application configuration should go into files in config/initializers
# -- all .rb files in that directory are automatically loaded.
config.sender_email = "stickynotes@outlook.jp"
config.middleware.insert_before 0, Rack::Cors do
allow do
origins ENV['ACCESS_CONTROL_ALLOW_ORIGIN'] || '*'
resource '*', :headers => :any, :methods => [:get, :post, :put, :options]
end
end
end
end

0 comments on commit b3f0570

Please sign in to comment.