Access To XMLHttpRequest Has Been Bloked By CORS Policy
Access to XMLHttpRequest at 'http://localhost:8080/ws' from origin 'http://localhost:3001' has been blocked by CORS policy: Response to preflight request doesn't pass access contro
Solution 1:
When invoking an XMLHttpRequest
, the browser makes a preflight request and checks for an Access-Control-Allow-Origin
header to determine whether the request should be allowed. You should edit your server code to send that header with a value that allows the domain of your client (or just *
to allow CORS requests from any origin). For example, if using a Node server with Express, you could do res.set('Access-Control-Allow-Origin', '*')
Post a Comment for "Access To XMLHttpRequest Has Been Bloked By CORS Policy"