IONIC-based project resolves cross-domain issues

Use Ionic framework to develop Hybrid App. The boss requires that in addition to using it on mobile phones, its html part can be deployed on the server for web use.

During the test, I encountered the problem of cross-domain Ajax requests (mobile apps will not have this problem because of the whitelist mechanism).

Fortunately, Ionic provides a proxy service that can forward requests to a designated server, which solves the cross-domain problem.

The configuration is as follows:

ionic.project
{“name”: “xxx”, “app_id”: “”, ” proxies”: “path”: “/api/”, “proxyUrl”: “http://api_host/api/”}

p>

Leave a Comment

Your email address will not be published.