0

I am working on some new vps for an application we use. Which are running on Ubuntu 18.04.2 behind a seperate haproxy vps which load balances between two front ends running the same code and app.

The app uses the google directions api to get distance of users from a specific place. The full error is

Message: 
file_get_contents(https://maps.googleapis.com/maps/api/directions/json?origin=[ORIGIN]&destination=[DESTINATION]&key=[KEY]): failed to open stream: php_network_getaddresses: getaddrinfo failed: Temporary failure in name resolution

I know the url works as I can go to it on a browser and it works on the current app which is running on a different server.

I have tried a lot of the suggestions on here. I have tried changing dns servers in

 /etc/network/interfaces
 /etc/resolv.conf 
 /etc/systemd/resolved.conf

Also tried changing server name in

hostnamectl 
/etc/hosts

restarting nginx 
rebooting server

I can ping google and maps.googleapis.com and get responses.

trying wget responded with

Resolving maps.googleapis.com (maps.googleapis.com)... failed: Temporary failure in name resolution.
wget: unable to resolve host address ‘maps.googleapis.com’
Alex M
  • 21
  • 1
  • 5

2 Answers2

0

Did you try wget https://maps.googleapis.com/maps/api/directions/json?origin=[ORIGIN]&destination=[DESTINATION]&key=[KEY] ? If this works, too, it's possibly just your application (server) that is not configured to use the systems proxy settings. Did you check that already?

pToker
  • 51
  • 4
  • wget did not work. updated question with error – Alex M Jul 04 '19 at 15:39
  • And the proxy is defined by?: `export https_proxy="https://PROXY_SERVER:PORT` Unfortunately ping is not a suitable test, since ICMP does not traverse proxies. (I don't know the product haproxy, so please correct me, if I am wrong on this) – pToker Jul 04 '19 at 15:51
  • I dont use haproxy for outgoing requests I dont think. I set up a default gw on eth1 which handles the connection I think. sorry if that doesnt make sense. – Alex M Jul 04 '19 at 16:03
  • Oh sorry I misunderstood that. So what do you get when you `dig maps.googleapis.com`? Is the DNS Server used, which you have configured or not? Maybe best if you post the output of this command... – pToker Jul 04 '19 at 16:13
  • I get the following response to dig . ; <<>> DiG 9.11.3-1ubuntu1.7-Ubuntu <<>> maps.googleapis.com ;; global options: +cmd ;; connection timed out; no servers could be reached – Alex M Jul 04 '19 at 16:21
  • So the DNS Server isn't reachable. You can ping maps.googleapis.com from this server using the FQDN, not the IP? Using Ubuntu Server or Ubuntu Desktop version? Is networkd or NetworkManager in charge? `systemctl status systemd-networkd.service` Is `systemctl status systemd-resolved.service` running or not? If it systemd-networkd and systemd-resolved are running, you should be able to see your configured DNS via `networkctl status`. If they're not there, they have not been applied. Have you executed `systemctl restart systemd-resolved.service` after altering /etc/systemd/resolved.conf? – pToker Jul 04 '19 at 16:33
0

I am not fully sure if this was the only part that fixed my issue but during all of my changes and everything else I went to do an update and was getting errors so I checked my ifconfig which seems to have gotten a bit corrupt or confused and was giving different errors so after wiping it and re-adding ip and gateway I am now getting responses.

Alex M
  • 21
  • 1
  • 5