Content security policy with grape-swagger-rails

205 Views Asked by At

I am trying to get my site work with grape-swagger-rails, on the initialiser I have the following.

GrapeSwaggerRails.options.tap do |options|
  options.url      = '/api/swagger_doc.json'
  options.app_name = 'MyApp'
  options.api_auth = 'bearer'
  options.api_key_name = 'Authorization'
  options.api_key_type = 'header'
  options.doc_expansion = 'list'
end

GrapeSwaggerRails.options.before_action do
  GrapeSwaggerRails.options.app_url = request.protocol + request.host_with_port
end

Im my routes.rb I have mount GrapeSwaggerRails::Engine => '/swagger'

Swagger-rails generates the swagger_doc.json endpoint and I can see the json file. But when I am visiting /swagger endpoint I am getting an error from Firefox

Content Security Policy: The page’s settings blocked the loading of a resource at inline (“script-src”).

This is on the inline script that is been generated on the swagger file.

0

There are 0 best solutions below