SoAanyip / React-FileUpload

Upload files async with xhr2 or iframe for IE. Supporting IE8+. React component.
310 stars 95 forks source link

doupload #21

Open guangming21 opened 7 years ago

guangming21 commented 7 years ago

has been blocked by CORS policy: Request requires preflight, which is disallowed to follow cross-origin redirect. when i use react-fileupload, i get this error, how can I fix it

nwkotto commented 7 years ago

@guangming21 This needs to be resolved on the server side. Cross-origin requests - e.g. a static site at https://domain-1.com/ making async requests to an API at https://domain-2.com/ - requires domain-2 to include special headers that say it's OK for domain-1 to make those requests.

Sometimes it's as simple as having the server include one header in the response - Access-Control-Allow-Origin: *

More info here: https://developer.mozilla.org/en-US/docs/Web/HTTP/Access_control_CORS