Using CloudFlare

Permalink 1 user found helpful
I've been using CloudFlare for many of my major high traffic volume concrete5 sites, and I'm getting the significant result now.

Our concrete5 Japan site was reviewed by a major Internet software website, and it caused the high volume traffic yesterday. But it withstood the high traffic volume.

Here is the implementation of concrete5 & CloudFlare for both developer and visitors.

==============================
CloudFlare DNS & Hosting provider setting
==============================

When developing or make the changes of your concrete5 site, you may want to bypass the CloudFlare network .

CloudFlare gives you "direct.EXAMPLE.com" subdomain as your direct access to the root domain.


E.g.
----------
EXAMPLE.COM
----------

CloudFlare suggest you to allocate
----------
direct.EXAMPLE.COM
----------
as your direct access

You need to create an "alias domain" that will point to the exactly same directory of your host server.

You could change "direct" to anything else. Make sure you modify all of your CloudFlare, hosting server and the following codes accordingly.

E.g., if you can changing the dev domain to be "access.EXAMPLE.COM". You want to change every "direct" to "access".



==============================
/config/site.php
==============================

So you want to insert the following code onto /config/site.php

<?php
if (strpos($_SERVER['HTTP_HOST'],'direct') !== FALSE) {
   define('REDIRECT_TO_BASE_URL', false);
}
?>


* If you're pasting inside of "<?php ?>" remove "<?php" & "?>* tags before inserting.

By default, concrete5 tries to re-direct you to the main domain.
But when you insert the code into site.php, when you access to the site "direct.EXAMPLE.com", it won't redirect the domain and keeps you at "direct.EXAMPLE.COM"



==============================
/elements/header_required.php (Optional)
==============================
This is the optional suggestion. So that Google and other search engine won't crawl and register your development-only subdomain.

Copy /concrete/elements/header_requied.php
To /elements/header_required.php

Then insert the following code at the bottom of the file

if (strpos($_SERVER['HTTP_HOST'],'direct') !== FALSE) {
?><meta name="robots" content="noindex, nofollow">
<?php
} else { ?>
<meta name="robots" content="index, follow">
<?php } ?>


* Make sure "<?php" and "?>" tags are properly wrapped and closed.




Enjoy CloudFlare powered concrete5 sites!

http://concrete5-japan.org/
http://yokosonews.com

* as of June 2011

katz515
 
DBKG replied on at Permalink Reply
I must be missing something. I have included the php code in my site.php file (on a few sites set up with CloudFlare) and my CloudFlare account is set up accordingly. I can access the dashboard directly and the toolbar is there, but on site pages, the c5 Edit bar appears briefly, then disappears completely. It only returns when I pause/bypass the CloudFlare network, which kind of defeats the purpose. I know javascript conflicts can cause similar behavior, but the only variable here that consistently causes this is CloudFlare. Any help would be appreciated.
katz515 replied on at Permalink Reply
katz515
Probably, you should turn off "Auto Minify (Web optimization)" regardless you embed this code or not in order to edit concrete5.