By default, your CacheFly account is setup to use our FTP origin. If you would rather use your own origin and have us fetch non cached objects automatically on first request, than you'll need to enable our Reverse Proxy(Origin Pull) feature. Below is an overview of how or Reverse Proxy system works, steps needed to enable Reverse Proxy, as well definitions of the settings for our Reverse Proxy.
How Does Reverse Proxy Work
The way our reverse proxy works is in the event of a cache miss(objects doesn't exist on the CDN), we proxy the request back to your origin, "on the fly", and fulfill the end-user's request and at the same time the object is cached. Now, any additional requests for that same object will be served from the CDN. We won't fetch this object from origin again, until any of the following conditions are met.
- The TTL(Time to Live) or Cache Control max-age time expires.
- The object is manually purged from cache.
Setting Up Reverse Proxy
To enable Reverse Proxy, you'll need to navigate to "Delivery Options" -> "Reverse Proxy". You'll now be brought to a page where you can enable CacheFly's Reverse Proxy service. Once you toggle the switch to the "On" position, you'll be able to enter in your origin domain(domain where your content is being stored) and the settings.
Note: Having the same objects uploaded to our FTP origin that our cacheing engine will be fetching from your origin can cause versioning mismatches in some situation. Its advisable to remove any objects from our FTP origin before enabling our Reverse Proxy feature.
Explanation of Settings
- TTL - The TTL (time to live) is a value in seconds in which we will check your origin to see if an object has changed. You can override this setting by setting a Cache-Control headers on your origin. If no cache control headers are present, the TTL setting will be used instead.
- Use Query Strings in Cache Key - This settings tells our cacheing engine whether to ignore query strings or use them as part of the cacheing key. If your origin uses query strings as a versioning tool, or to dynamically modify your static content, you'll want to enable this setting.
- Origin Protocol - This setting tells our cacheing engine what protocol to use on Reverse Proxy requests back to your origin.
Finishing it up
Once you have setup our Reverse Proxy with the necessary settings for your environment, your content should now be accessible through CacheFly. Take the following object for example.
http://origin.mywebsite.com/path/to/file.jpg is now available at http://username.cachefly.net/path/to/file.jpg
Now that the reverse proxy service is configured, the last step is to edit your HTML source to use the statically addressed objects on the CDN. If your web site is ran from a CMS, most offer plugins that will assist in rewriting the URLs for all static objects for you.
If you have any questions about using this service, please feel free to contact us at firstname.lastname@example.org. Someone from our support team will be happy to assist!