【问题标题】:Google Geocode API from China IPv6来自中国 IPv6 的 Google Geocode API
【发布时间】:2014-07-28 09:32:15
【问题描述】:

从我们上海的服务器访问geocode api时,它连接到IPv6,但我们的提供商不支持它并且请求失败。

但是,当从欧洲或美国访问时,它只连接到 IPv4 并且工作正常。

这是上海服务器的输出

curl -v -IL 'http://maps.googleapis.com/maps/api/geocode/json' 
* About to connect() to maps.googleapis.com port 80 (#0)
* Trying 74.125.128.95... Connection timed out
* Trying 2404:6800:4005:c00::5f... Failed to connect to 2404:6800:4005:c00::5f: Network is unreachable
* Success
* couldn't connect to host
* Closing connection #0
curl: (7) Failed to connect to 2404:6800:4005:c00::5f: Network is unreachable

这是来自欧洲的输出:

curl -v -IL 'http://maps.googleapis.com/maps/api/geocode/json'
* About to connect() to maps.googleapis.com port 80 (#0)
* Trying 173.194.70.95... connected
> HEAD /maps/api/geocode/json HTTP/1.1
> User-Agent: curl/7.22.0 (i686-pc-linux-gnu) libcurl/7.22.0 OpenSSL/1.0.1 zlib/1.2.3.4 libidn/1.23 librtmp/2.3
> Host: maps.googleapis.com
> Accept: */*
> 
< HTTP/1.1 200 OK
HTTP/1.1 200 OK
< Content-Type: application/json; charset=UTF-8
Content-Type: application/json; charset=UTF-8
< Date: Fri, 13 Jun 2014 11:50:43 GMT
Date: Fri, 13 Jun 2014 11:50:43 GMT
< Expires: Sat, 14 Jun 2014 11:50:43 GMT
Expires: Sat, 14 Jun 2014 11:50:43 GMT
< Cache-Control: public, max-age=86400
Cache-Control: public, max-age=86400
< Vary: Accept-Language
Vary: Accept-Language
< Access-Control-Allow-Origin: *
Access-Control-Allow-Origin: *
< Server: mafe
Server: mafe
< X-XSS-Protection: 1; mode=block
X-XSS-Protection: 1; mode=block
< X-Frame-Options: SAMEORIGIN
X-Frame-Options: SAMEORIGIN
< Alternate-Protocol: 80:quic
Alternate-Protocol: 80:quic
< Transfer-Encoding: chunked
Transfer-Encoding: chunked

< 
* Connection #0 to host maps.googleapis.com left intact
* Closing connection #0

【问题讨论】:

    标签: google-maps google-geocoding-api


    【解决方案1】:

    如果其他人有这个问题,这里是来自谷歌支持的回复。


    是的,要从中国访问 Google 地图,请使用“ditu.google.cn”域名而不是“maps.googleapis.com”

    例如: http://ditu.google.cn/maps/api/geocode/json?sensor=false&address=Sydney

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-12-11
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-03-18
      • 2012-07-29
      相关资源
      最近更新 更多