react-redux-starter-kit icon indicating copy to clipboard operation
react-redux-starter-kit copied to clipboard

Add CORS headers

Open macnibblet opened this issue 7 years ago • 3 comments

Heya,

Awesome starter kit been using it for a long time, but I just noticed in either a recent update of google chrome or the starter kit that i'm getting CORS errors on hot-update if I don't use my machines local ip when accessing the project.

This is a problem for me since we have all project setup to either use dev:3000 staging:3000 production:3000 and we use the domain of the current visit to determine which environment the frontend api should hit.

Adding cors headers to the hot updates would resolve this and shouldn't really be a security concern during development.

macnibblet avatar Jun 16 '17 12:06 macnibblet

We have fixed it by adding 'headers' prop into server/main.js

    stats       : project.compiler_stats,
    headers: { 'Access-Control-Allow-Origin': '*' }

  }))
  app.use(require('webpack-hot-middleware')(compiler, {
    path: '/__webpack_hmr'

mvehar avatar Jun 16 '17 15:06 mvehar

so close the issue ?

neolectron avatar Jul 09 '17 18:07 neolectron

No, because this needs to be added to the server/main.js and @mvehar solution works, needs to be merged by a pr :)

macnibblet avatar Jul 11 '17 11:07 macnibblet