is there any way to improve the caching ?
thanks
Without knowing how your website is made, no one can help you. Cloudflare can only cache images, HTML, CSS, and JS, not PHP or other technologies that you may be using.
i have an index.php and that loads html pages which contain some images and css
<?php
// check for valid pages and select page and title
switch($_GET['page'])
{
case 'servers':
// $page = 'servers.php';
$page = 'servers.html';
$title = 'Servers';
break;
case 'art':
$page = 'art.html';
$title = 'Gallery';
break;
case 'projects':
$page = 'projects.html';
$title = 'Projects';
break;
case 'project-z80-disassembler':
$page = 'project-z80-disassembler.html';
$title = 'Project Z80 Disassembler';
break;
case 'project-ladybug-bbc':
$page = 'project-ladybug-bbc.html';
$title = 'Project Lady Bug BBC';
break;
case 'project-ladybug':
$page = 'project-ladybug.html';
$title = 'Project Lady Bug';
break;
case 'websites':
$page = 'websites.html';
$title = 'Websites';
break;
case 'error400':
$page = 'error400.html';
$title = '400';
break;
case 'error401':
$page = 'error401.html';
$title = '401';
break;
case 'error403':
$page = 'error403.html';
$title = '403';
break;
case 'error404':
$page = 'error404.html';
$title = '404';
break;
case 'error500':
$page = 'error500.html';
$title = '500';
break;
case 'error503':
$page = 'error503.html';
$title = '503';
break;
case 'blank-template':
$page = 'blank-template.html';
$title = 'Blank Template';
break;
default:
$page = 'news.html';
$title = 'News';
}
?>
<!DOCTYPE html>
<!--
__ _____
| | ___ _ _ ___| __ |_ _ ___
| |__| . | | | -_| __ -| | | . |
|_____|___|\_/|___|_____|___|_ |
|___|
-->
<html lang='en'>
<head>
<meta charset='UTF-8'>
<title>LoveBug - <?php echo $title; ?></title>
<link rel='icon' type='image/png' href='/images/favicon-mushroom-48.png' />
<link rel='stylesheet' href='/lovebug.css?<?php echo filemtime($_SERVER["DOCUMENT_ROOT"] . "/lovebug.css"); ?>' />
</head>
<body id='main-body'>
<!-- include navigation menu -->
<?php include $_SERVER['DOCUMENT_ROOT'] . '/navigation.html'; ?>
<!-- end navigation menu -->
<!-- spacer before content -->
<div class='spacer'></div>
<!-- end spacer -->
<!-- include required page content -->
<?php include $_SERVER['DOCUMENT_ROOT'] . '/' . $page; ?>
<!-- end page content -->
</body>
</html>
So the PHP doc is not cached, but the HTML files probably are. So each reload is going to cause at least one un-cached hit (from the PHP file).
oh thanks, maybes its ok then
HTML is not included in the cache
it must be enabled
You’re welcome
Now you just need to remember when you make some changes (like uploading newer versions)
to make a purge all on the CF cache section (or a selective purge - which sometimes doesn’t really work for me)
so CF starts serving fresh versions of pages or files, not cached ones.
yeah i’ll do that, thanks
Just to draw your attention to one thing:
Page Rules (if you have more than one) they depend on the priority
so the ones you put higher (number 1 for example) will have higher priority
compared to the ones below, so if you have some problems and it doesn’t behave as you determined then you need to take care of the priority.
eg I have cache everything (for all)
but I also have a few PHP (dynamic) pages that I excluded from the cache policy because otherwise, I would serve the same page to each visitor instead of having the ability to post something and get a session and cookies, etc.
So I need to isolate such pages (URL / PATH) from the cache evr. rule and serve them as a standard cache.
thanks for the tip
currently my game servers are offline but when (if) i can bring them back i’ll have to add a rule to not cache the players online page
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.