Ionic can't get open cors

后端 未结 3 1619
慢半拍i
慢半拍i 2021-01-17 03:34

I am trying to get API data from live server in ionic android app but it returns this error:

Access to XMLHttpRequest at \'https://example.com/api/categories         


        
3条回答
  •  离开以前
    2021-01-17 04:32

    Perhaps at some point a preflight OPTIONS request is done by the client and since it isn't a listed method in your Access-Control-Allow-Methods it ends up in a CORS issue.

    You should try to make a request to your server endpoint with OPTIONS method to check if this is the case, you can use POSTMAN to make this test.

    Then try to add the OPTIONS method to the Access-Control-Allow-Methods and check the difference.

提交回复
热议问题