间歇连接问题EC2,letsencrypt SSL

I am experiencing a bizarre connectivity issue to my react native application.

It appears I can connect to the API on one device but not the other, on the same network. Also the issue is intermittent, I usually can connect on both devices.

Observations so far

  • Server is up and running and I can ping it. Restarted the server, PHP, nginx, just in case.
  • Tried connecting with Postman, various browsers, on my phone, and on my mac. Also used an android simulator. When it can't connect it appears the device cannot connect in any way. Although pinging the server is still successful and I can ssh in.
  • I believe the request does not hit the server. There are no logs that indicate my requests were received.
  • Switching between WiFi and the phone's data connection does not fix the issue.
    • I have also tried a variety of cache-control settings such as in the request cache-control: no-cache and in the response cache-control: no-cache, no-store, must-revalidate, private. I only just did this though so not sure if it takes time for it to work since something might already be cached?

The site is on an AWS EC2 instance, has letsencrypt SSL, laravel 5, nginx.

The issue ended up being due to conflicting DNS records. I had set up some DNS records on AWS Route53 but did not realise my domain provider also had some default records there when I bought my domain. The result being that sometimes it would use the correct records at AWS and sometimes it would use the nonsense records.

So to fix I deleted all the records at my domain provider. After some propagation time this fixed the issue. Hope this helps someone.