从上海的服务器访问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
答案 0 :(得分:2)
如果有其他人遇到此问题,请点击Google支持人员的回复。
是的,要从中国访问Google地图,请使用“ditu.google.cn”域名代替“maps.googleapis.com”
例如: http://ditu.google.cn/maps/api/geocode/json?sensor=false&address=Sydney