content_security_policy.rb 1.3 KB

1234567891011121314151617181920212223242526272829
  1. # frozen_string_literal: true
  2. # Be sure to restart your server when you modify this file.
  3. # Define an application-wide content security policy
  4. # For further information see the following documentation
  5. # https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy
  6. # Rails.application.config.content_security_policy do |policy|
  7. # policy.default_src :self, :https
  8. # policy.font_src :self, :https, :data
  9. # policy.img_src :self, :https, :data
  10. # policy.object_src :none
  11. # policy.script_src :self, :https
  12. # policy.style_src :self, :https
  13. # # If you are using webpack-dev-server then specify webpack-dev-server host
  14. # policy.connect_src :self, :https, "http://localhost:3035", "ws://localhost:3035" if Rails.env.development?
  15. # # Specify URI for violation reports
  16. # # policy.report_uri "/csp-violation-report-endpoint"
  17. # end
  18. # If you are using UJS then enable automatic nonce generation
  19. Rails.application.config.content_security_policy_nonce_generator = ->(_request) { SecureRandom.base64(16) }
  20. # Report CSP violations to a specified URI
  21. # For further information see the following documentation:
  22. # https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy-Report-Only
  23. # Rails.application.config.content_security_policy_report_only = true