Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Add development CORS policy for Storybook
  • Loading branch information
developius committed Aug 29, 2021
1 parent ee6b52b commit bc68b7c
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 0 deletions.
1 change: 1 addition & 0 deletions Gemfile
Expand Up @@ -34,6 +34,7 @@ gem "jbuilder", "~> 2.7"

gem "view_component", require: "view_component/engine"
gem "view_component_storybook"
gem "rack-cors"

group :development, :test do
# Call "byebug" anywhere in the code to stop execution and get a debugger console
Expand Down
3 changes: 3 additions & 0 deletions Gemfile.lock
Expand Up @@ -138,6 +138,8 @@ GEM
nio4r (~> 2.0)
racc (1.5.2)
rack (2.2.3)
rack-cors (1.1.1)
rack (>= 2.0.0)
rack-test (1.1.0)
rack (>= 1.0, < 3)
rails-dom-testing (2.0.3)
Expand Down Expand Up @@ -191,6 +193,7 @@ DEPENDENCIES
importmap-rails (>= 0.3.4)
jbuilder (~> 2.7)
puma (~> 5.0)
rack-cors
rails!
selenium-webdriver
sqlite3 (~> 1.4)
Expand Down
7 changes: 7 additions & 0 deletions config/environments/development.rb
Expand Up @@ -64,4 +64,11 @@

# Uncomment if you wish to allow Action Cable access from any origin.
# config.action_cable.disable_request_forgery_protection = true

config.middleware.insert_before 0, Rack::Cors do
allow do
origins '*'
resource '/rails/stories/*', :headers => :any, :methods => [:get]
end
end
end

0 comments on commit bc68b7c

Please sign in to comment.