React-redux-starter-kit: Add CORS headers

Created on 16 Jun 2017  路  3Comments  路  Source: davezuko/react-redux-starter-kit

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.

Most helpful comment

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'

All 3 comments

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'

so close the issue ?

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

Was this page helpful?
0 / 5 - 0 ratings

Related issues

dfalling picture dfalling  路  5Comments

enesTufekci picture enesTufekci  路  5Comments

nie-xin picture nie-xin  路  4Comments

BigPrimeNumbers picture BigPrimeNumbers  路  4Comments

ciokan picture ciokan  路  4Comments