Issue
i tried to fix this problem using the server proxy
{
"name": "my_app",
"integrations": {
"cordova": {}
},
"type": "angular",
"proxies": [
{
"path": "/api",
"proxyUrl": "my_url"
}
]
}
then i replaced in my enviroment fodler my variable baseUrl: '/api'
it not work, where i mistake?
Solution
CORS should be enabled on the server-side by sending Access-Control-Allow-Origin
header with a proper value. So in most cases you have nothing to do with it on the client-side (Angular/Ionic).
For example if you're trying to access API resource served on GET https://example.com/api/users
, the endpoint among other headers should return Access-Control-Allow-Origin
as well.
More about CORS: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS
How to enable it: https://enable-cors.org/server.html
Answered By - Andrey Etumyan
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.