Cloudflare keeps caching 'direct' url.

Permalink 1 user found helpful
I'm trying to use cloudflare with my concrete5 site.

I have set up a direct.website.com subdomain for editing the site so cloudflare doesn't cache this. However, the site is consistently saving the 'direct' url in the hyperlinks, image sources ect which is causing the site to show up as insecure and redirecting users to the direct url.

How do you overcome this?

I've turned off concretes built in caching however it doesn't seem to of made a difference.

Thanks.

Dalecarslaw
 
Mnkras replied on at Permalink Reply
Mnkras
Have you tried setting the Canonical URL in the dashboard?
Dalecarslaw replied on at Permalink Reply
Dalecarslaw
Hi Sorry for late reply,

I thought I solved this issue but it's still occurring. I've tried a load of different things all of which have failed including setting the canonical URL in the dashboard.

Right now it's setting up a 'CDN' environment from following a guide I seen used for amazon web services which I amended to work with cloudflare. This is an incredibly irritating issue.

Currently I have all concrete caching switched off.

It uses start.php to determine which environment to use (either normal, or CDN). I have verified this is working, it's serving the correct file.

Inside of cdn.concrete.php is the following code:
<?php
return array(
    'cache' => array(
        'blocks' => true, // turn on block cache
        'pages' => 'blocks', // cache page if all blocks support it.
    ),
    'seo' => array(
        'canonical_url' => 'http://www.website-name.co.uk/',
        'canonical_ssl_url' => 'https://www.website-name.co.uk/',
    ),
);


However, consistently links on the site and file paths are being saved as direct.website-name.co.uk. Driving me insane!

Thanks for your help.
cmcg replied on at Permalink Reply
Hi, did you manage to get this to work and what code did you use in start.php to determine which environment to use if the CDN is cloudflare?
Thanks
Dalecarslaw replied on at Permalink Reply
Dalecarslaw
No this still doesn't work 100%.

The code to detect environment is as follows:

<?php
use Concrete\Core\Application\Application;
/**
 * ----------------------------------------------------------------------------
 * Instantiate concrete5
 * ----------------------------------------------------------------------------
 */
$app = new Application();
/**
 * ----------------------------------------------------------------------------
 * Detect the environment based on the hostname of the server
 * ----------------------------------------------------------------------------
 */
$app->detectEnvironment(
    function(){


As I said, this works in detecting and setting the environment but it still doesn't stop the URLs being cached.