Files
openfoodnetwork/config/initializers/storybook.rb
Matt-Yorkley 453328a97e 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
2021-04-22 15:08:54 +02:00

15 lines
430 B
Ruby

# 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