soulrebel
soulrebel

Reputation: 51

Google Geocode API from China IPv6

When accessing geocode api from our servers in Shanghai, it connects to IPv6, but our provider doesn't support it and requests fails.

However, when accessing from Europe or US, it connects to IPv4 only and works fine.

Here is the output from Shanghai servers

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

And this is the output from Europe:

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

Upvotes: 2

Views: 1121

Answers (1)

soulrebel
soulrebel

Reputation: 51

If anybody else have this problem, here is a response from google support.


Yes, to access Google Maps from China, use the "ditu.google.cn" domain name instead of "maps.googleapis.com"

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

Upvotes: 2

Related Questions