IONIC 3 CORS ISSUE

后端 未结 7 2382
小蘑菇
小蘑菇 2020-12-09 18:16

I am having a CORS issue with Ionic 3 when attempting to make GET calls to an API. I am using Ionic local server, running ionic serve in the command line for li

7条回答
  •  春和景丽
    2020-12-09 18:55

    the proxy functionality expects that you're referencing the local server. in your GET request, you're still pointed at the remote API. If you change your code to this.http.get('/games/...' it should start to function as the request will go to http://localhost:8100/games..., which the "proxy" option will catch and pass on to the URL you've provided.

    You may also only need to put https://api-2445582011268.apicast.io in the proxyUrl field. I think the rest of the path is passthrough.

提交回复
热议问题