diff options
author | yuuji.yaginuma <yuuji.yaginuma@gmail.com> | 2018-10-12 18:14:48 +0900 |
---|---|---|
committer | yuuji.yaginuma <yuuji.yaginuma@gmail.com> | 2018-11-04 10:51:39 +0900 |
commit | fd30a3237c572fc9727a4dc59edbb08b6569a761 (patch) | |
tree | 39248caaf92a3b7452f76a474b7946faf10a62f0 /railties/lib | |
parent | caad9e1080e5b98bc8b3c40c0f2d226a3a9e859a (diff) | |
download | rails-fd30a3237c572fc9727a4dc59edbb08b6569a761.tar.gz rails-fd30a3237c572fc9727a4dc59edbb08b6569a761.tar.bz2 rails-fd30a3237c572fc9727a4dc59edbb08b6569a761.zip |
Add `connect_src` example to content security policy initializer
If want to use `webpack-dev-server` with CSP enabled, need to specify
`connect-src`.
Related to: https://github.com/rails/webpacker/commit/cd7ecf4d48496341aecd81c0c2f69fe4e50a7cd4
This is a matter of `webpacker`. But since `webpacker` is now used by
default, to prevent user confusion, I think that better to include an
example of `connect-src.`
Diffstat (limited to 'railties/lib')
-rw-r--r-- | railties/lib/rails/generators/rails/app/templates/config/initializers/content_security_policy.rb.tt | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/railties/lib/rails/generators/rails/app/templates/config/initializers/content_security_policy.rb.tt b/railties/lib/rails/generators/rails/app/templates/config/initializers/content_security_policy.rb.tt index d3bcaa5ec8..c517b0f96b 100644 --- a/railties/lib/rails/generators/rails/app/templates/config/initializers/content_security_policy.rb.tt +++ b/railties/lib/rails/generators/rails/app/templates/config/initializers/content_security_policy.rb.tt @@ -11,6 +11,10 @@ # policy.object_src :none # policy.script_src :self, :https # policy.style_src :self, :https +<%- unless options[:skip_javascript] -%> +# # If you are using webpack-dev-server then specify webpack-dev-server host +# policy.connect_src :self, :https, "http://localhost:3035", "ws://localhost:3035" if Rails.env.development? +<%- end -%> # # Specify URI for violation reports # # policy.report_uri "/csp-violation-report-endpoint" |