Reputation: 647
I have created an Ionic App which communicates with a middleware server based REST API. The App performs user authentication. So that I can test the app in the browser (Google Chrome), I have been installed the Chrome extension called CORS
and I have activated the extension every time when I wanted to test the user authentication in the browser. It worked well. Now I have installed the app on the device and my user authentication no longer works. But I have found so a setting:
{
"name": "proxy-example",
"app_id": "",
"proxies": [
{
"path": "/api",
"proxyUrl": "http://cors.api.com/api"
}
]
}
This setting should be saved in the ionic.project
file. But I don't unterstand it well. What is actually path
and proxyUrl
. which url shuold I put for proxyUrl
? The endpoint(link) of the authentification link?
So that my User authentication also works on the device, what should I do?
Upvotes: 0
Views: 840
Reputation: 5766
Well, your ionic.project
file should reside in the root directory of your project. (Alongside www/
)
path
- The request prefix that you have to specify to forward all such request requests to your proxyUrl
.proxyUrl
- The actual url of your REST API.After you successfully add the ionic.project file and re-build your project, this should work.
Example:
path to REST API: http://example.com/api/
,
then setting path
: /api
and proxyUrl
: http://example.com/api/
will forward all requests from your application to the specified proxyUrl which begin with /api
Upvotes: 1