Use environment variables to inject the right server host and port into your app.Enable CORS on your server ( here’s how to do it for Express).If the proxy option is not flexible enough for you, alternatively you can: The proxy option supports HTTP, HTTPS and WebSocket connections. Any unrecognized request without a text/html accept header will be redirected to the specified proxy. Keep in mind that proxy only has effect in development (with npm start), and it is up to you to ensure that URLs like /api/todos point to the right thing in production. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled. Origin ' is therefore not allowed access. Fetch API cannot load No 'Access-Control-Allow-Origin' header is present on the requested resource.
0 Comments
Leave a Reply. |