mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-11 23:17:48 +00:00
Configure CORS settings for StoriesController
- Storybook need to access through a GET method on `/rails/stories/**` served by `ViewComponent::Storybook::StoriesController` - Configure exact policy with an initialized filter
This commit is contained in:
committed by
Jean-Baptiste Bellet
parent
d674490896
commit
453328a97e
14
config/initializers/storybook.rb
Normal file
14
config/initializers/storybook.rb
Normal file
@@ -0,0 +1,14 @@
|
||||
# Adjust headers to allow running Storybook in development.
|
||||
# Uses iframes and doesn't play nicely with CORS checks
|
||||
|
||||
if Rails.env.development?
|
||||
module PermissiveCORSHeaders
|
||||
def self.before(response)
|
||||
response.headers["Access-Control-Allow-Origin"] = "*"
|
||||
response.headers["Access-Control-Allow-Methods"] = "GET"
|
||||
end
|
||||
end
|
||||
|
||||
ViewComponent::Storybook::StoriesController.before_action(PermissiveCORSHeaders)
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user