开发者

503 error from Google Books API when accessed from EC2

On my Amazon EC2 instance:

~$ curl -XGET https://www.googleapis.com/books/v1/volumes?q=Mark+Twain
{
 "error": {
  "errors": [
   {
    "domain": "global",
    "reason": "unknownLocation",
    "message": "Cannot determine user location."
   }
  ],
  "code": 503,
  "message": "Cannot determine user location."
 }
}

The same request from my laptop yields the proper response -- book data in JSON format.

What am I doing wrong? Is it Amazon's network configuration? Is it Google? Is it me? It would help just to know if EC2 users in other availability zones see the same开发者_JAVA技巧 error for this request.


I know this is a very old question, but it still deserves an answer...

Google returns the error named above:

  1. When it cannot determine where your IP is located. Its licensing agreements for many of its books require knowledge of where you are.

  2. When the IP is in an internal blacklist for being an open proxy. EC2 has been known to be used to host proxies, perhaps the previous owner of your IP got tagged by Google.

  3. When an X-forwarded-for header is present (this would be appended by various proxies), that IP is used instead. If that is an internal ip (like 10.0.0.1), Google complains. This should not be an issue for a vanilla EC2 instance, as you have an external IP address for external traffic, but if you are doing something with a VPC or VPN, madness might occur.

I could not reproduce this error for us-east today, but only tested one instance in a random availability zone.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜