How to configure ionic apk to use https

i build an android application using ionic framework using angular and capacitor, when i call my api with http its work fine and i get data, but when i use https i get canceled status in the debugger, the server work fine with https, i try to call the api with postman and its work fine, so if there is any configuration or plugin to add i would be glad to be informed;

What is the code that you are using to call your API? If you API endpoint supports HTTPS, there shouldn’t be any configuration needed in your app.

my endpoint is https://mobile.com/url
and i am using httpClient of angular.
anyway when i use http i get data but when i use https i get canceled status in the debuger, and by the way when i try to fetch data using https from the browser or postman its work fine, but from the mobile i get this problem.

If I click that link it says the connection is not safe, so you have to fix your certificates

the url is privatem, it’s not exposed on the internet yet; and this is what my debugger show with status canceled

What are the errors in the Console?

the previeus image was the detail of this image

What does the Console tab show?

nothing sir,
in my android studio i dont get any errors. i am using this tools : chrome://inspect/#devices for debugging

Are you sure? :slight_smile: Your screenshot shows errors.

image

It probably has something to do with your SSL certs but not sure without more info.

Since the domain is not active yet to the public, what sort of SSL cert are you using? Self-signed or from a certificate authority?

Also, where do you have the DNS set for your domain? Since it isn’t public, you would need to make sure your Android device is pointed to the correct DNS server so it can resolve the domain.

I’m currently utilizing a certificate authority for security purposes.

the server and the api are in the same network (local network)

everything operates smoothly, including browsing on both HTTP and HTTPS. However, I’m encountering a peculiar issue where HTTPS requests get canceled only when accessed from a mobile device, while HTTP works without any problems.

Make sure that your SSL certificate is properly configured.