Pay Per Use Mirror Content Delivery Network (PPU-MirrorCDN)
SimpleCDN's PPU-MirrorCDN service automatically mirrors and caches your content from any HTTP accessible file store, making your content instantly available via SimpleCDN's Content Delivery Network.

MirrorCDN is not a storage or archival service, rather it acts as a global HTTP Accelerator. Think of MirrorCDN as being similar to Varnish or Squid Cache, except with many more features, and distributed across the world.

MirrorCDN is a pay per use service, with usage billed per GB of data transferred to end users. There are no additional storage or per-request charges.


Starting Point
In order to use the MirrorCDN service, you must first define a Mirror Target. A Mirror Target instructs MirrorCDN where to mirror content from. You use the SimpleCDN Manager to create Mirror Targets.
Mirror Target Example
Mirror Target: http://simplecdn.s3.amazonaws.com/
MirrorCDN Domain: http://mirror1002.simplecdn.com/
Requests to http://mirror1002.simplecdn.com will be mirrored from http://simplecdn.s3.amazonaws.com/

Mirror Target Example #2 - Hiding Folder Names
Mirror Target: http://simplecdn.s3.amazonaws.com/folder1/folder2/
MirrorCDN Domain: http://mirror1003.simplecdn.com/
Requests to http://mirror1003.simplecdn.com will be mirrored from http://simplecdn.s3.amazonaws.com/folder1/folder2/
From Previous Example - Showing Folder Path on mirror1002.simplecdn.com


Request Overview
When a MirrorCDN Edge Cache receives a request for a file, it first checks to see if that file is currently available in its cache.
If it is, then the file is returned to the user.
If not, then the Edge Cache will attempt to contact SimpleCDN's Master Cache for the file.
If SimpleCDN's Master Cache has the file, the file will be returned to the Edge Cache, which will then return it to the user.
If not, then the Master Cache will attempt to retrieve the file from the Mirror Target.
If the Mirror Target actually has the file and returns a 200 OK, the file will be downloaded by the Master Cache, sent to the Edge Cache, and then returned to the user.


Cache Updates
MirrorCDN will monitor your Mirror Target a few times per day with HEAD requests, checking for updated content. When updated content is found, it is cached across the global CDN.

Coming Soon: Manual cache updates and an API to request cache updates of certain files.

Content may be removed from Edge Caches and/or Master Caches after a period of download inactivity (a few days). Requests for removed content will still function, since MirrorCDN will re-cache your content from the Mirror Target.


Instant CNAME Support
SimpleCDN's distributed architecture maintains a real-time DNS snapshot of the global Internet. This allows SimpleCDN to respond to CNAME DNS requests in near real-time (depending on your DNS server's cache settings).

To create your own CNAME DNS entry for your MirrorCDN Domain, simply follow the instructions below:
1 - Create CNAME DNS Entry for your new domain on your DNS server.
mirror.mydomain.com     CNAME     mirror<your-mirror-id>.simplecdn.com
2 - Wait 5-10 minutes for your DNS server cache to update.
3 - Use your new CNAME in all MirrorCDN requests.
http://mirror.mydomain.com/<your-file-name>

Notes:
Only HTTP requests are allowed, as HTTPS requests with your CNAME will throw SSL certificate errors to the browser.
Unlimited CNAME records are allowed per mirror domain.

CNAME Example:


PRE-Function | Image Resizing
MirrorCDN can automatically resize any image, and cache the resized file for instant access.

Function Name: _fn_imageresize

Usage: Use to resize images from your Mirror Target. Resized images are cached for instant access.

Parameters: (image_width,image_height,resize_method)

Example: http://mirror1002.simplecdn.com/_fn_imageresize/750,750,1/250x250.png

image_width
Number; From 1 to 2000
image_height
Number; From 1 to 2000
resize_method
Number;
1 - Maintain Image Aspect Ratio
Image will be resized to largest dimension, and then other dimension will be automatically calculated to preserve image aspect ratio.
http://mirror1002.simplecdn.com/_fn_imageresize/1500,100,1/250x250.png
Resulting image is 100x100, even though requested size was 1500x100.
2 - Force Dimensions
Image will be resized to requested dimensions, and distorted if needed.
http://mirror1002.simplecdn.com/_fn_imageresize/1500,50,2/250x250.png
Resulting image is 1500x50, and has been distorted.
3 - Black Letterbox
Image will be resized to maintain aspect ratio, and resulting image will have exact dimensions as entered.
http://mirror1002.simplecdn.com/_fn_imageresize/1500,450,3/250x250.png
Resulting image is 1500x450 as requested, and original image has been scaled to maintain aspect ratio.
4 - White Letterbox
Same as 3 but with white background.
5 - Grey Letterbox
Same as 3 but with grey background.


PRE-Function | AnyURL
MirrorCDN can automatically pull files from any HTTP server by using a specially crafted URL against MirrorCDN. For security, requests must be signed to ensure others do not use your MirrorCDN account for themselves.

Function Name: _fn_anyurl

Usage: Use to have MirrorCDN pull a file from any HTTP server.

Parameters:
URLSafeBase64(target_web_address) / URLSafeBase64(signature) / Optional_NewFileName

Example: Example Link
Target Web Address: http://images.apple.com/iphone/home/images/hero20080609.png
URL Safe Base64 of Target Web Address: aHR0cDovL2ltYWdlcy5hcHBsZS5jb20vaXBob25lL2hvbWUvaW1hZ2VzL2hlcm8yMDA4MDYwOS5wbmc=
Signature (HMAC-SHA1 Digest of URL Safe Base64 of Target Web Address): L8j9PeYzo4VezIsVf0yIT2YgnSA=
Computed Using MirrorCDN AnyURL Key from SimpleCDN Manager

Constructing URLSafeBase64(target_web_address) in pseudo-grammar:
TargetAddress = "http://images.apple.com/iphone/home/images/hero20080609.png";

TargetAddress_Base64 = ToBase64(TargetAddress);

// Now we have Base64, but we need to make URL Safe.
// Base64 contains "+" and "/" and we need to change those two characters.
// Change "+" to "-"
// Change "/" to "_"

TargetAddress_Base64_URLSafe = Replace(TargetAddress_Base64,"+","-");
TargetAddress_Base64_URLSafe = Replace(TargetAddress_Base64_URLSafe,"/","_");

// Result Should Be... 
// aHR0cDovL2ltYWdlcy5hcHBsZS5jb20vaXBob25lL2hvbWUvaW1hZ2VzL2hlcm8yMDA4MDYwOS5wbmc=
[Note]Note

URL Safe is not the same as URL Encoded or Percent Encoded encodings.

Simply put, all you are doing is replacing the "+" character with the "-" (dash) character, and the "/" character with the "_" (underscore) character in your Base64 encoded string. Below is a script for PHP to convert a string to URL Safe Base64:

function urlSafeBase64_encode( $string )
{
  $string = base64_encode( $string );               // encode to base64
  $string = str_replace( '+', '-', $string );       // replace + with -
  $string = str_replace( '/', '_', $string );       // replace / with _
  return $string;
}


Constructing Signature in pseudo-grammar:
MirrorCDNAnyURLKey = "0123456789abcdefg";

StringToSign = TargetAddress_Base64_URLSafe;

// Now We Sign The String, And Convert the Digest to Base64

Digest = HMAC-SHA1( StringToSign );

Signature_Base64 = ToBase64( Digest );

// Now we Have Signature in Base64, but we need to make URL Safe.
// Base64 contains "+" and "/" and we need to change those two characters.
// Change "+" to "-"
// Change "/" to "_"

Signature_Base64_URLSafe = Replace(Signature_Base64,"+","-");
Signature_Base64_URLSafe = Replace(Signature_Base64_URLSafe,"/","_");

// access key: 0123456789abcdefg
// to sign: aHR0cDovL2ltYWdlcy5hcHBsZS5jb20vaXBob25lL2hvbWUvaW1hZ2VzL2hlcm8yMDA4MDYwOS5wbmc=

// result: UiGN58EH_sIZgR6cHCXx_n0_SUc=


At the end of the URL you may enter any "filename", which will help to ensure the server sends the correct mime-type to the browser. Even though the AnyURL is going and getting a file named hero20080609.png, we have decided to call the image iphone.png. You may enter anything here, it will not affect the AnyURL, just the way the browser handles the file download.


PRE-Function Stacking
Certain MirrorCDN functions may be stacked together. For example, you may place _fn_imageresize before _fn_anyurl.

Example: Example Link

This example combines the iPhone image example from the AnyURL function, with the Image Resize function, resizing the image to 1200 x 1200 with a grey letterbox.
Notice how the Image Resize function supports transparency in PNGs.


Query Strings
MirrorCDN will NOT honor requests with query strings for static elements, rather query strings will be stripped from requests made against MirrorCDN.

However, requests for .html, .htm, .shtml, .jsp, .cfm, .php, .asp and .aspx files that contain query strings will be transparently proxied to the origin server.
Will Cache: http://mirror1000.simplecdn.com/app/findzipcode.php
Will Proxy: http://mirror1000.simplecdn.com/app/findzipcoderesult.php?zipcode=90210

For example, MirrorCDN will treat the following three image requests as equal, and will serve the same file to all three.
http://mirror1000.simplecdn.com/images/image7.jpg
http://mirror1000.simplecdn.com/images/image7.jpg?trackingcode=6
Will Serve: http://mirror1000.simplecdn.com/images/image7.jpg
http://mirror1000.simplecdn.com/images/image7.png?watermarkid=64&serialnumber=5465123
Will Serve: http://mirror1000.simplecdn.com/images/image7.png

This is done to prevent like files from continually being re-cached due to varying query strings, which are very common these days due to web analytic software, etc.
Tools such as mod_rewrite for Apache may be used instead to offload dynamic content to MirrorCDN, by forming URLs without query strings.


HTTP POST Requests
MirrorCDN will NOT cache HTTP POST request responses, and will instead transparently proxy HTTP POST requests to the origin server.


Service Billing
MirrorCDN is billed on a per GB of data transferred model. Charges for transfer are calculated and billed against your SimpleCDN Credit balance throughout the day.

If your account does not have enough credits to pay for current GB usage, your account may be terminated within 72 hours.
Copyright © 2008 SimpleCDN Technologies, Inc. All rights reserved.     Terms of Service    Privacy Policy