Last active
February 4, 2024 13:08
-
-
Save raelgc/799cadce1303bd604a38bc3808d272b4 to your computer and use it in GitHub Desktop.
Rack Cors configuration for Vite
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# TODO: Add production URLs to the list | |
# Use '*' if you want expose the API to the world | |
accept = [ | |
'http://127.0.0.1:5173', # Dev Frontend | |
'http://localhost:5173', # Dev Frontend | |
'http://127.0.0.1:5174', # Dev Frontend | |
'http://localhost:5174', # Dev Frontend | |
] | |
Rails.application.config.middleware.insert_before 0, Rack::Cors do | |
allow do | |
origins accept | |
resource '*', | |
headers: :any, | |
methods: %i[get post put delete options patch], | |
expose: %w[Authorization] | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment