Source Code: May 2005 Archives

Cache CGI for offloading content to cheap host

| | Comments (0)

The good news, is that I painted my motorcycle.

The bad news is, I posted a url to the pictures, and other folks are inline imaging that photo on various forums, and it is risking my colo bandwidth bill into overage.

The good news, is I've written a cache to offload these requests to, to run on a cheap shared hosting environment, where they bill by total bandwidth per month instead of on semi-peak usage.

index.cgi

Edit the file to suit your needs. Be sure to edit the part where you indicate what paths you are willing to cache and serve - this was meant to only serve the data I wanted to serve, and not to be the latest slashdot abuse host.

An example of the script in action:

http://cache.gigo.com/index.cgi/gallery.gigo.com/jfesler/st1300/.lowres/aag.jpg

index.cgi is the script itself. The path before it is where I placed it on a cheap host. The path after that, is the web url I want mirrored.

You can set the parameters on how often it should refresh a mirror. If there were no changes (and the source is not dynamic), then the mirror should be cheap to refresh.

There is no cache cleanup script (yet). I'll post that here, when I've gotten around to writing that. :-)

About this Archive

This page is a archive of entries in the Source Code category from May 2005.

Source Code: September 2004 is the previous archive.

Source Code: February 2007 is the next archive.

Find recent content on the main index or look in the archives to find all content.

Powered by Movable Type 4.0