0

I use webpack to build the react project, separate the font and images and other media files. When the html show, the main.js will get the resource automatically. The SPA html and js files are on different domains, then the browser show 'Access-Control-Allow-Origin' error message. How should I do to resolve it?

GibboK
  • 71,848
  • 143
  • 435
  • 658
  • Can you share the full error message? And what have you tried to resolve that error? Willhttps://stackoverflow.com/questions/20035101/why-does-my-javascript-get-a-no-access-control-allow-origin-header-is-present help? – Nico Haase Jun 28 '18 at 11:26

1 Answers1

0

You can tweak the HTTP header on your origin server. All it takes is an additional HTTP header called Access-Control-Allow-Origin which allow CORS.

A useful resource to get started:

https://enable-cors.org/

GibboK
  • 71,848
  • 143
  • 435
  • 658