Your instance benefits from a powerful cache system that works with Varnish.
This allows you to distribute the content of your website
This will allow you to distribute the content of your website to a larger number of visitors without using the resources of your instance.
If for some reason you would like to deactivate the cache system on your pages, you must add a the following header: HTTP Cache-Control: public, max-age=1
For example, in php:
header("Cache-Control: max-age=1");
Or in an .htaccess file if it is a static website:
Header add Cache-Control "max-age=1"
Note that the performance of your instance will be reduced without the cache system in place.
It is possible to purge a particular url cache by sending a HTTP PURGE request.
Note:
The PURGE requests are only working from your virtual machine.Here is an example:
<?php /* purge.php * Purge an url on this host */ header("Cache-Control: max-age=1"); // don't cache ourself error_reporting(E_ALL); ini_set("display_errors", 1); // Set to true to hide varnish result define("SILENT", false); $path = isset($_GET["path"]) ? $_GET["path"] : ""; $purge_url = "http://" . $_SERVER["HTTP_HOST"] . "/$path"; if ( $ch = curl_init($purge_url) ) { curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "PURGE"); curl_setopt($ch, CURLOPT_NOBODY, SILENT); curl_exec($ch); curl_close($ch); } ?>
Example use : http://1234.betasimple.net/purge.php?path=/page-to-purge
Note:
For wordpress we recommend using the following plugin http://wordpress.org/extend/plugins/varnish-http-purge/
Last modified: 19 Dec 2011 at 13:12 by William D. (Gandi)