Block Coral Cache / Coral CDN

Deny CoralCache from Indexing Your Site

CoralCache aka Coral CDN gives users access to a sort of ‘cached’ copy of your website, in case your site were to be offline. You can also set up your site to serve images and assets from the CoralCache CDN url – by appending to your domain name.

If you don’t like the idea of a copy of your site floating around out there, you’re not alone.

There is a bit of good news about how CoralCDN works, though:

  1. It blocks content from being indexed at the cached location. Just try and visit the cached site’s /robots.txt
  2. It only caches content that has been requested. It won’t crawl your website and create an entire cache of the site. That is, only when people try to browse your site and append the will the CoralCache server crawl your site and index the requested pages and assets.
  3. It does respect expires headers sent with the content

Now, how do you block CoralCache from indexing your site?

If you have WordPress add this to the very top of your wp-config.php file, right below the opening < ?php tag. It works even if you are using WP SuperCache in PHP mode:

if(!empty($_SERVER['HTTP_USER_AGENT']) && stripos($_SERVER['HTTP_USER_AGENT'], 'CoralWebPrx') !== false)tested
    echo 'No caching allowed for CoralCache / CoralCDN';
    echo "<script>window.location = document.location.href.replace('','')";

If you do not have WordPress you can do this with your .htaccess file if you are on an Apache web server – add this near the top of the file:

<ifmodule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTP_USER_AGENT} CoralWebPrx [NC]
RewriteRule (.*) coral.htm [L]

You will also want to put a coral.htm file in the same directory as the .htaccess file with the contents being something like:

<p>No caching allowed for CoralCache / CoralCDN</p>
"<script>window.location = document.location.href.replace('','')</script>"

You can test it out with this page:

If you try to test this you’ll need to test it on a page of your site that has not recently been requested via the CoralCDN – or wait until the cache times out. It should display the message briefly and then redirect to the corresponding page on your website.

Related Posts:

  • No Related Posts
This entry was posted in Tech Tips and tagged . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *