M0UNTAIN 0F C0DE

For my Raspberry Pi Image Manager project I wanted to show a progress bar as an image is downloaded. This was easy as a simple HEAD request would include in the response a Content-Length header telling me the size and allowing progress to be calculated.

This worked until I wanted to include the RetroPie image. The RetroPie devs store their images on GitHub, not a problem you might think, business as normal. GitHub however don't allow HEAD requests to downloads, no idea why. So now I had no way of getting the image size without downloading the whole image.

At least not without some hackery...

I was recently involved in setting up a complex load balanced Auto-scaling multi server setup and to make life easy I wanted to set a header that contained the servers hostname so it was clear which server behind the load balancer satisfied each request.

I thought this would be easy... Not so much! But I managed it and here's how...