diff --git a/Gemfile b/Gemfile index 2dd8062..73a09f8 100644 --- a/Gemfile +++ b/Gemfile @@ -12,6 +12,7 @@ gem "graphql" gem "jquery-rails" gem "pg", "~> 0.18" gem "puma", "~> 3.0" +gem "rack-cors" gem "rails", "~> 5.1.4" gem "react-rails", "~> 1.10.0" gem "sass-rails", "~> 5.0" diff --git a/Gemfile.lock b/Gemfile.lock index e8c233a..08e5c56 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -116,6 +116,7 @@ GEM pry (>= 0.10.4) puma (3.10.0) rack (2.0.3) + rack-cors (1.0.2) rack-test (0.7.0) rack (>= 1.0, < 3) rails (5.1.4) @@ -214,6 +215,7 @@ DEPENDENCIES pg (~> 0.18) pry-rails puma (~> 3.0) + rack-cors rails (~> 5.1.4) rails-assets-bootstrap (= 4.0.0.alpha.6)! react-rails (~> 1.10.0) diff --git a/config/initializers/cors.rb b/config/initializers/cors.rb new file mode 100644 index 0000000..9d6e80e --- /dev/null +++ b/config/initializers/cors.rb @@ -0,0 +1,8 @@ +Rails.application.config.middleware.insert_before 0, Rack::Cors do + allow do + origins "elementary.com.dev" + resource "*", + headers: :any, + methods: %i[get post put patch delete options head] + end +end