Skip to content

Commit

Permalink
Configure CORS
Browse files Browse the repository at this point in the history
  • Loading branch information
larslevie committed Nov 22, 2017
1 parent a018105 commit 1f87ae4
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 0 deletions.
1 change: 1 addition & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 2 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down
8 changes: 8 additions & 0 deletions config/initializers/cors.rb
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 1f87ae4

Please sign in to comment.