google-api – Google Storage API Forbidden ipRefererBlocked错误

使用Google Storage
JSON API时出现以下错误:

$curl -v 'https://www.googleapis.com/storage/v1/b/MY-BUCKET/o?key=MY_API_KEY'
* Hostname was NOT found in DNS cache
*   Trying 64.233.186.95...
* Connected to www.googleapis.com (64.233.186.95) port 443 (#0)
* TLS 1.2 connection using TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA
* Server certificate: *.storage.googleapis.com
* Server certificate: Google Internet Authority G2
* Server certificate: GeoTrust Global CA
> GET /storage/v1/b/MY-BUCKET/o?key=MY_API_KEY HTTP/1.1
> User-Agent: curl/7.37.1
> Host: www.googleapis.com
> Accept: */*
> 
< HTTP/1.1 403 Forbidden
< Vary: X-Origin
< Content-Type: application/json; charset=UTF-8
< Date: Tue, 31 Mar 2015 16:57:40 GMT
< Expires: Tue, 31 Mar 2015 16:57:40 GMT
< Cache-Control: private, max-age=0
< X-Content-Type-Options: nosniff
< X-Frame-Options: SAMEORIGIN
< X-XSS-Protection: 1; mode=block
* Server GSE is not blacklisted
< Server: GSE
< Alternate-Protocol: 443:quic,p=0.5
< Accept-Ranges: none
< Vary: Origin,Accept-Encoding
< Transfer-Encoding: chunked
< 
{
 "error": {
  "errors": [
   {
    "domain": "usageLimits",
    "reason": "ipRefererBlocked",
    "message": "There is a per-IP or per-Referer restriction configured on your API key and the request does not match these restrictions. Please use the Google Developers Console to update your API key configuration if request from this IP or referer should be allowed.",
    "extendedHelp": "https://console.developers.google.com"
   }
  ],
  "code": 403,
  "message": "There is a per-IP or per-Referer restriction configured on your API key and the request does not match these restrictions. Please use the Google Developers Console to update your API key configuration if request from this IP or referer should be allowed."
 }
}

但似乎一切都配置正确.我正在使用的密钥被列为允许任何IP:

API本身是活动的:

该项目已正确配置计费信息:

我已尝试启用和禁用API并刷新结算信息.什么都没有帮助.什么是下一个步骤?试试AWS?

最佳答案 后人在这里发生了什么:

我在同一个数据中心(纽瓦克/新泽西州的Linode)中运行了一个不同的虚拟机,它工作得很好,所以问题似乎不是我的关键,而是我的IP本身.

为了解决这个问题,我不得不向Google Cloud支付150美元,这样他们就可以让我打开支持票并描述问题.

接下来的两天,我和支持人员争论说 – 虽然很有礼貌 – 总是认为错误是在我的最终而不是他们的.

在写了6000个字符的回复后,他最终决定与某人核实并发现我的IP已被Google交通自动化系统阻止,因为它错误地检测到我的IP来自受限制的国家(伊朗).

鉴于VM位于新泽西州 – 通过traceroute很容易看到 – 他们告诉我他们必须手动覆盖系统并将我的IP放回美国.这需要三天,所以我等了.

三天后,我收到一封电子邮件告诉我测试一切,所以我做了.它没用.经过另外几封电子邮件并等待另一天,他们终于修复了它.

整个混乱局面中的樱桃正在让Google支持人员指责我的公司与受限制的国家开展业务,并代理来自伊朗的流量.这是荒谬的,它真的冒犯了我们,因为即使犯了一个错误,他们仍然想责怪我们没有做错任何事.

我们告诉两位工程师向后转动虚拟机,看看他们是否能找到任何被黑客攻击的证据,当然他们不能.它是一个完全修补的Ubuntu 14.04服务器,只能通过一个私钥SSH和远程root登录被禁用.

伙计们,这就是故事的结局.消费150.00美元,通知谷歌他们自己的错误,并不得不争取解决方案.

哦,还有一件事:我们正在迁移到AWS.

点赞