Skip to content

Commit

Permalink
Add note about CSP connect-src and webpack-dev-server
Browse files Browse the repository at this point in the history
  • Loading branch information
guilleiguaran committed Dec 9, 2017
1 parent a61f8fe commit cd7ecf4
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,12 @@ you can set the `host` when running `./bin/webpack-dev-server` binstub:
WEBPACKER_DEV_SERVER_HOST=0.0.0.0 ./bin/webpack-dev-server
```

**Note:** You need to allow webpack-dev-server host as allowed origin for `connect-src` if you are running your application in a restrict CSP environment like Rails 5.2+. This can be done in Rails 5.2+ for development environment in the CSP initializer `config/initializers/content_security_policy.rb` with a snippet like this:

```ruby
p_connect_src :self, :https, 'http://localhost:3035', 'ws://localhost:3035' if Rails.env.development?
```

**Note:** Don't forget to prefix `ruby` when running these binstubs on windows

### webpack configuration
Expand Down

0 comments on commit cd7ecf4

Please sign in to comment.