android - Why does the APK run on https automatically although I did not load frontend over it? How to bypass the issue? - Stack

I'm building a smart budgeting Ionic Android App, it was working smoothly when I was running the c

I'm building a smart budgeting Ionic Android App, it was working smoothly when I was running the command:

ionic cap run android -l --external

But when I built the apk, suddenly the frontend is loaded over https and I'm getting this error:

polyfills-4BK4MXU4.js:1 Mixed Content: The page at 'https://localhost/tabs/stats/expenses/3' was loaded over HTTPS, but requested an insecure XMLHttpRequest endpoint 'http://3.87.224.134:3000/expenses/6jHsnfpriwRm1i22DhqAVrIfP2R2/2'. This request has been blocked; the content must be served over HTTPS.

I don't know how out of a sudden my page is loaded on another protocol, I tried resolving it using:

android:usesCleartextTraffic="true"

and in capacitor.config I used :

server: {
cleartext: true

}

The two didn't have an effect on this. What's the problem? How to fix it? Where is the https coming from?

I'm building a smart budgeting Ionic Android App, it was working smoothly when I was running the command:

ionic cap run android -l --external

But when I built the apk, suddenly the frontend is loaded over https and I'm getting this error:

polyfills-4BK4MXU4.js:1 Mixed Content: The page at 'https://localhost/tabs/stats/expenses/3' was loaded over HTTPS, but requested an insecure XMLHttpRequest endpoint 'http://3.87.224.134:3000/expenses/6jHsnfpriwRm1i22DhqAVrIfP2R2/2'. This request has been blocked; the content must be served over HTTPS.

I don't know how out of a sudden my page is loaded on another protocol, I tried resolving it using:

android:usesCleartextTraffic="true"

and in capacitor.config I used :

server: {
cleartext: true

}

The two didn't have an effect on this. What's the problem? How to fix it? Where is the https coming from?

Share Improve this question asked Mar 20 at 15:09 geio bou sleimengeio bou sleimen 415 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 0

Modern browsers and environments block HTTP requests for security reasons. Ensure that all API endpoints you are calling are served over HTTPS. Also dont fet to update your capacitor.config.json:

{
  "server": {
    "cleartext": true,
    "url": "https://0.00.000.000:3000" // or your actual server URL
  }
}

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744400692a4572370.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信