Rails 5.2 Beta 2 + Webpacker + ActionCable- 1 min
This is mainly for myself so that I can remember what the heck I did to get this working in case I need it for the future.
Refused to connect to 'http://localhost:3035/sockjs-node/info?t=1515515117689' because it violates the following Content Security Policy directive: "default-src 'self' https:". Note that 'connect-src' was not explicitly set, so 'default-src' is used as a fallback.
The thing to do to fix this is to update
config/initializers/content_security_policy.rb and add a
connect_src configuration like so:
p.connect_src :self, :https, "http://localhost:3035", "ws://localhost:3035"
This seems to configure the content security policy to allow the ActionCable to still work while using Webpacker. NOTE: This probably won’t fix it in your automated tests. There is a note about this in one of the issue comments, but I have not tested this out myself.