javascript – Is it possible to connect the Google Maps API through reverse proxy in my app?-ThrowExceptions

Exception or error:

I am working on an app where I want to use the Google Maps API.

The problem is the connection to Google Maps API server is unstable. Sometimes it’s OK but other times it’s blocked because I’m in China.

The solution I’ve come up with is to make all the Google Maps API requests through a reverse proxy. I can setup a server as a reverse proxy in American or Hong Kong where there is a steady connection to Google maps server.

Then I have to change the urls of all the Google Maps APIs in my app to point to my reverse proxy and the proxy will proxy_pass all the requests to Google Maps server.

There are a few questions I have about this:

How would I go about implementing the client side libraries? Do I have to change them? If so, can I just download the Google Maps JavaScript API file and change the domain names of the urls in it to the domain of my proxy server?

And how would I go about Android and iPhone apps? I’m uncertain whether the Android and iPhone SDKs will make the request with http protocol. If it is, how can I replace the domain names of the APIs with the domain name of my proxy server?

I thought maybe there is a way to catch all the http requests made in my app and modify them before they get sent but after googling for a while I’ve found it’s hard to do.

So is it possible to do this with Android and iPhone apps? Or is there a better way to achieve it with a web app?

I also would like to know is it worth the effort to do this since the solution seems to be rather complex and using the Google Maps API is not a necessity because there are replacements to it in our country. I just prefer Google Maps API to them because of its neat API style and the prettier look of maps.

How to solve:

Your solution is a blatant violation of Google’s terms and conditions.

10.1.1 (a) You must not access or use the Maps API(s) or any Content through any technology or means other than those provided in the Service, or through other explicitly authorized means Google may designate.
For example, you must not access map tiles or imagery through interfaces or channels (including undocumented Google interfaces) other than the Maps API(s).

Legal issues aside, I think you answered your own question. “Google Maps API is not a necessity because there are replacements to it in our country”.

But if your hell-bent on using Google Maps you can use their tiles with a 3rd party library like leaflet for web content. Native mobile apps are an entirely different problem though…one which I suspect is either a: not possible or b: not feasible.


FWIW, this doc from Google states it is acceptable to cache map images.

Leave a Reply

Your email address will not be published. Required fields are marked *