Quantcast
Channel: Ionic Framework - Ionic Forum
Viewing all articles
Browse latest Browse all 49083

React Project To Ionic - API Network Error

$
0
0

Hello there,

I’m transforming a react project into an ionic project.
I build my commits with Appflow and preview the web. When I run the project over Ionic Hub, it cannot connect to the API and returns an error. (Network Error)
I download the project as a zip file and distribute it over IIS. I do not have any problems here. What can be the problem?
I don’t think there is a problem with Cors. Because it wouldn’t work on my own IIS either.

I made the following setting in the capacitor.config.json file, but it didn’t work.
"server": {
** “allowNavigation”: “[‘http://web.com’]”**
** },**
Then I entered the proxy information as below in the package.json file, but that didn’t work for me either.
"proxy": "http://web.com"

Then I added the following settings for the axios library that I connected to the API. But there was no solution for me.

axios.defaults.baseURL = API_URL;
** axios.defaults.headers.post [‘Content-Type’] = ‘application / json; charset = utf-8’;**
** axios.defaults.headers.post [‘Access-Control-Allow-Origin’] = ‘*’;**

I want to deploy a React project with Ionic for mobile devices. However, I have to overcome such problems.

1 post - 1 participant

Read full topic


Viewing all articles
Browse latest Browse all 49083

Trending Articles