I have an API in a VPS that i rent in Hostinger, everything is set up and i also bought a domain from them, which is already linked with my VPS IP and looks fine, but the problem is when i request my VPS trough my HTTPS domain in React Native. I used certbot to emit a SSL Certificate with Let's Encrypt. It's funny because if i request the API via Insomnia or a ReactJS Web, the response is almost instantaneous, but in React Native takes up to 60 secs or more to reach the API, if i wait long enough i receive the response and other sub-sequent requisitions starts to be instantaneous.
I already tried to start a blank Expo React Native App and the problem persists when trying to fetch the API, that beign said, i don't think the problem is with my App... Maybe something in the DNS configuration or the SSL Certificate that i generated? Also, if no https used (Direct IP to my VPS trough http) the requests reach my API instantaneous too...
OBS: My API is running in a Ubuntu 22, directly in default https 443 port, with pm2, no nginx
If more information needed, please let me know, thanks in advance for any help!
EDIT: The DNS was configured today 2023-07-23 16:00 PM, i was told that the DNS propagation may take a while - about 24 Hours to really normalize things - so, should i wait or maybe is another error?
It turns out that the problem was the DNS IPv6, it is correctly configured, but for some reason, only using React Native (Expo Managed Workflow) the API can't be accessed via IPv6, to solve the issue i defined a timeout to my axios.defaults of 4000ms, now my App has 4 seconds to try via IPv6, if it does not respond, more 4 seconds are given to try in IPv4, which answers my requisition correctly
To anyone that wants to setup the Axios API Service like i do:
import axios from "axios";
export const api = axios.create({
baseURL: 'https://your-api-domain-address.com'
});
export const setupApiService = () => {
api.defaults.timeout = 4000;
};
Hope that helps anyone that ends with this strange behavior on React Native DNS problem