Saturday, August 11, 2018

Ionic 4 + Capacitor Calling Local API Blocked Mixed Content Error

Problem:
Ionic 4 + Capacitor app running locally on device. NodeJS + Express + MongoDB API running local on http (not https).

Can hit local API successfully when running Ionic in browser on API url localhost or IPv4 address (e.g. 192.168.15.8).

When running on device (connected via USB) get the following error on all API calls (in Chrome developer tools network tab): (blocked-mixed-content)

Solution:
Add: "allowMixedContent": true
To: \capacitor.config.json
https://github.com/ionic-team/capacitor/issues/630

No comments:

Post a Comment