Skip to content

Commit e038135

Browse files
committed
Add CORS support for Vercel frontend
1 parent 298bf06 commit e038135

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

Gemfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,3 +84,4 @@ group :test do
8484
gem "faker"
8585
gem "rspec-collection_matchers"
8686
end
87+
gem "rack-cors"

config/initializers/cors.rb

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# frozen_string_literal: true
2+
3+
Rails.application.config.middleware.insert_before 0, Rack::Cors do
4+
allow do
5+
origins 'https://gathering-greenwood.vercel.app',
6+
'http://172.232.24.146',
7+
'http://localhost:5173',
8+
'http://localhost:3000'
9+
10+
resource '*',
11+
headers: :any,
12+
methods: [:get, :post, :put, :patch, :delete, :options, :head],
13+
credentials: true
14+
end
15+
end

0 commit comments

Comments
 (0)