'Error: XMLHttpRequest error. in flutter web whenever i call a local sms to client
i am having an issue of Error: XMLHttpRequest error. inside my flutter web for api calling.its working on mobile version but throwing an error while running in chrome
here is my header section headers: { "Access-Control-Allow-Origin": "*", // Required for CORS support to work "Access-Control-Allow-Credentials": 'true', // Required for cookies, authorization headers with HTTPS "Access-Control-Allow-Headers": "Origin,Content-Type,X-Amz-Date,Authorization,X-Api-Key,X-Amz-Security-Token,locale", "Access-Control-Allow-Methods": "POST, OPTIONS" });
can anyone help me
Solution 1:[1]
The server doesn't allow cross origin access. See CORS.
If the server allows it, then it will respond to the preflight request with an Access-Control-Allow-Methods response header. E.g.
OPTIONS /resource/foo
Access-Control-Request-Method: DELETE
Access-Control-Request-Headers: origin, x-requested-with
Origin: https://foo.bar.org
HTTP/1.1 204 No Content
Connection: keep-alive
Access-Control-Allow-Origin: https://foo.bar.org
Access-Control-Allow-Methods: POST, GET, OPTIONS, DELETE
Access-Control-Max-Age: 86400
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 |
