A while ago I made the decision to locally mirror my static Google Maps images, purely for reasons of performance - Google were excruciatingly slow at rendering them and I'd just poured a heap of effort into optimizing everything else, only to have my pageload times dragged down by Google of all people.

It turned out this was a good idea, because they recently switched over to requiring everyone to use API keys, which would have broken things on me anyway. In fact, it did break things - my visit to my cousin involved an entry for a place I'd never visited before, and so the map did not exist. When I tried to generate it, I got a blank image - because I didn't provide an API key.

So I signed up for a key, and it looks like I'll be well below the level where I'd actually have to pay for anything, so not really any harm done. Delete and purge the entries for the maps that weren't validly generated, and I'm back in business.

But it got me thinking that there's probably a nicer way to do this - I could probably use some fancy Nginx configurations to proxy the requests over to Google, appending my API key to the proxy (hidden so clients wouldn't see it), then automatically cache the response in Nginx. Cloudflare would cache that too, and I wouldn't have to run a script each time. Do I care enough to do that though? Only downside is there's a chance I might run up more requests doing things that way, and my API key would be present on a machine on the internet instead of an isolated container at home.

Definitely need to think long and hard before I worry about doing that.

Horsham, VIC, Australia fwaggle




Filed under:


Horsham, VIC, Australia

Navigation: Older Entry Newer Entry