【问题标题】:Google Storage API Forbidden ipRefererBlocked ErrorGoogle Storage API 禁止 ipRefererBlocked 错误
【发布时间】:2015-06-05 03:12:30
【问题描述】:

使用 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?

【问题讨论】:

  • 你从哪个 IP 地址连接?
  • 我试图重现您的问题,但到目前为止我还无法重现。尝试删除 API 密钥并生成一个新密钥。另外,如果可能,请尝试使用不同的 IP。
  • 我也无法重现该问题。我确实注意到 Stackoverflow 上有一些案例,供人们使用 Google Calendar API 和 Youtube API 遇到相同问题。解决他们的问题是: - 从凭据窗格中删除服务器密钥 - 停用/重新激活所需的 API - 创建新的服务器密钥 我遇到的一个问题是错误 401 授权。为了解决这个问题,我运行了 gsutil acl set public-read gs://MY-BUCKET/
  • 您找到解决此问题的方法了吗?
  • 嗨亚当,我自己回答了这个问题;)

标签: google-api google-cloud-storage


【解决方案1】:

为了后代,发生了什么事:

我在同一个数据中心(纽瓦克/新泽西州的 Linode)创建了一个不同的 VM,它运行良好,所以问题似乎不是我的关键,而是我的 IP 本身。

为了查明真相,我不得不向 Google Cloud 支付 150.00 美元,这样他们才能让我开支持票并描述问题。

接下来的两天里,我一直在与一名支持人员争论——尽管非常有礼貌——但我一直认为错误是我的问题,而不是他们的问题。

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

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

三天后,我收到一封电子邮件,告诉我要测试所有内容,我就照做了。它没有用。在又发了几封电子邮件并又等了一天后,他们终于修好了。

最糟糕的是,一名 Google 支持人员指控我的公司与受限制的国家/地区开展业务,并充当来自伊朗的流量的代理。那太荒谬了,真的冒犯了我们,因为即使犯了错误,他们仍然想责备我们没有做错任何事情。

我们告诉两名工程师将虚拟机倒转,看看他们是否能找到任何证据表明它已被黑客入侵,当然他们找不到。这是一个完全修补的 Ubuntu 14.04 服务器,只能通过一个私钥进行 SSH,并且远程 root 登录被禁用。

这就是故事的结局,伙计们。花费 150.00 美元通知谷歌他们自己的错误,并且不得不努力解决问题。

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

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2013-06-16
    • 1970-01-01
    • 1970-01-01
    • 2012-01-17
    • 1970-01-01
    • 2015-05-28
    • 1970-01-01
    • 2017-11-04
    相关资源
    最近更新 更多