'Why can't I connect to the google-translate API on the server?
Integration of my Ruby application with google translate API stopped working on my server. From outside the application also fails to get the correct response from the API.
In the app and through curl, I get the error:
403. That’s an error.
Your client does not have permission to get URL <code>/language/translate/v2</code> from this server. That’s all we know.
But if I check it through my home computer, then everything works correctly:
curl "https://translation.googleapis.com/language/translate/v2?key=#{MY_GOOGLE_KEY}&source=en&target=de&q=Hello%20World"
==>
{
"data": {
"translations": [
{
"translatedText": "Hallo Welt"
}
]
}
}
Could there be problems in the system itself on the server?
cat /etc/os-release
PRETTY_NAME="Debian GNU/Linux 8 (jessie)"
NAME="Debian GNU/Linux"
VERSION_ID="8"
VERSION="8 (jessie)"
up1
checked on the same system with debian 8 and got the current answer from api. So, now I have a theory that there is some problem with the ip (although the ip is included in the trusted list)
up2
the main reason was the blocking of ip on the territory of germany by google. here is message by Linode:
We've been alerted of reports from customers experiencing the same issue with accessing Google's API. From what we have gathered so far, Google is blocking our IPv6 /64 block in Frankfurt. We've already reached out to Google and they are currently looking into it.
Solution 1:[1]
There’s some things that you might consider: this error normally is caused due to cache, and erasing the cache sometimes might help to fix it. Other times, you just need to restart the server. On the other hand, there’s not much you can do to fix things on your end. Either you’re really not allowed to access the resource, or there’s an error on the server side. Sometimes, it’s a temporary error, and sometimes it isn’t. Still, there are some things you can try, as mentioned above. The second reason is that the owners of the web server have improperly set up permissions, and you’re getting denied access when you really shouldn’t be.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Jose Gutierrez Paliza |
