Instant CDN on Google App Engine

This is Instant CDN on Google App Engine clone built on Flask with some tweaks and additions. You can contact me at profile page.

Features

This web service will retrieve the resource located on your server, cache it on Google App Engine servers and serve it to your users with smart cache headers. This will provide the following benefits:

Basic usage: file cache

Replace all your files urls with:


http://needfeeder.appspot.com/c/[unique_path]?url=[file_url]

For example, to cache an image at http://www.google.com/intl/en_ALL/images/logo.gif, use this url:


http://needfeeder.appspot.com/c/google/logo.gif?url=http://www.google.com/intl/en_ALL/images/logo.gif

Image Size

To resize your image, specify a size parameter, i.e:


http://needfeeder.appspot.com/c/google/logo.small.gif?url=http://www.google.com/intl/en_ALL/images/logo.gif&size=100x100

Valid values for size parameter:

Size can also be specified in file name, i.e. logo.small__100x100c.gif (note double underscore).

Subdomain

You can use subdomains to avoid collisions with already existed file, i.e.:


http://[subdomain].needfeeder.appspot.com/c/google/logo.small.gif?url=http://www.google.com/intl/en_ALL/images/logo.gif&size=100x100


API

Adding file


http://needfeeder.appspot.com/a/[unique_path]?url=[url]&size=[image_size]

Response:

Serving file


http://needfeeder.appspot.com/s/[unique_path]

Response:

Caching file

This is combination of adding and serving file in one step. If file at [unique_path] exists on server (i.e. is already cached) it will be served. Otherwise file will be fetched from the [url] and cached on the server, then cached file will be served.

http://needfeeder.appspot.com/c/[unique_path]?url=[url]&size=[image_size]

Response:

If size can't be recongized or file is not image nothing happens.