react-redux-starter-kit
react-redux-starter-kit copied to clipboard
Add CORS headers
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.
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 :)