Heroku sporadically returns "hostname" not found

I am creating an iOS application that uses the Rails API server on Heroku. Periodically (once every 20 API calls) the hero cannot be found. The following NSError is returned:

Error Domain=NSURLErrorDomain Code=-1003 "A server with the specified hostname could not be found." UserInfo=0x755ce00 {NSErrorFailingURLStringKey=https://xxx.herokuapp.com/api/v1/matchups, NSErrorFailingURLKey=https://xxx.herokuapp.com/api/v1/matchups, NSLocalizedDescription=A server with the specified hostname could not be found., NSUnderlyingError=0x71ca730 "A server with the specified hostname could not be found." 
+4
source share
3 answers

It sounds like you are getting into Dyno's sleep behavior. Please check this documentation , especially the Dynamic Sleep section, and make sure you understand it. There are also several ways to save the application, for example, regularly ping the site.

Another option is DNS, creating an Ad-Hoc network on your computer and connecting your iphone to this network. Use wirehark to create network capture and analysis of DNS and HTTP responses.

0
source

It looks like a DNS problem on the network your iPhone / iPad is connected to. To verify, try one of the following:

1) Change the host name to IP address instead of the host name of the string and add the Host: HTTP request header.

2) If (1) is difficult, install your iPhone DNS on a PC on your local network and install a DNS server on this PC and at least execute this specific address directly from the PC (do not rewrite the domain for this).

0
source

Your url = https://xxx.herokuapp.com/api/v1/matchups

Did you explicitly specify your xxx subdomain with your domain provider to direct it to the IP address of your server?

If not, try adding a new A record with your xxx subdomain to the IP address of your server.

Hope this helps.

0
source

Source: https://habr.com/ru/post/1491433/


All Articles