question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Access Control Allow Origin?

See original GitHub issue

What is might be the problem here? Do I need to set some setting on the dev server for this to work?

Failed to load resource: the server responded with a status of 404 (Not Found)
10.0.1.27/:1 XMLHttpRequest cannot load http://10.0.1.27:9090/build/2590dcf104e749604e15.hot-update.json. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://10.0.1.27:8080' is therefore not allowed access. The response had HTTP status code 404.

Issue Analytics

  • State:closed
  • Created 9 years ago
  • Comments:31 (7 by maintainers)

github_iconTop GitHub Comments

31reactions
jbasdfcommented, Feb 20, 2015

Thanks @Dakuan, I ended up setting the headers when I start the server. Here’s the code:

var webpackDevServer = require('webpack-dev-server');
new webpackDevServer(webpack(webpackConfig), {
  publicPath: "http://localhost:8080/build",
  hot: true,
  headers: { "Access-Control-Allow-Origin": "*" }
}).listen(settings.ports.hotPort, 'localhost', function(err, result){
  if(err){
    console.PluginError(err);
  }
  console.log('Webpack hot load server listening on port ' + settings.ports.hotPort);
});
23reactions
michaelBenincommented, Apr 28, 2017

@hugotox in your webpack config, try adding this:

devServer: {
    headers: { "Access-Control-Allow-Origin": "*" }
  },
Read more comments on GitHub >

github_iconTop Results From Across the Web

Access-Control-Allow-Origin - HTTP - MDN Web Docs - Mozilla
The Access-Control-Allow-Origin response header indicates whether the response can be shared with requesting code from the given origin.
Read more >
How does the 'Access-Control-Allow-Origin' header work?
The Cross-origin resource sharing (CORS) mechanism gives web servers cross-domain access controls, which enable secure cross-domain data transfers. Modern ...
Read more >
CORS and the Access-Control-Allow-Origin response header
The Access-Control-Allow-Origin header is included in the response from one website to a request originating from another website, and identifies the permitted ...
Read more >
The Access-Control-Allow-Origin Header Explained
Access -Control-Allow-Origin is a CORS header. CORS, or Cross Origin Resource Sharing, is a mechanism for browsers to let a site running at ......
Read more >
Allow CORS: Access-Control-Allow-Origin
Allow CORS: Access-Control-Allow-Origin lets you easily perform cross-domain Ajax requests in web applications. Simply activate the add-on ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found