I have a CakePHP website whose homepage is cached for 10 minutes at a time using Cake's default settings. However, I was warned that “every once in a while,” once a day or so, he was losing the layout by simply displaying the contents of the page without a title, style, etc.
Removing the cached version and restoring the page seems to fix the problem. But why could this happen in the first place? I can’t say I saw this happening myself (in any of my CakePHP projects), but does anyone else have any experience with this or any ideas on how to fix it? Really appreciate!
EDIT: looking at the file with the damaged home.php cache compared to the working cache file, I noticed this line:
$controller->layout = $this->layout = 'ajax'; //broken $controller->layout = $this->layout = 'default'; //working
It is like a breakthrough. I assume that sometimes a page is called using an Ajax request and then cached in this format until the cache expires. Does anyone know why this could happen (I don’t think we are trying to call the main page via Ajax anywhere, and we don’t even have an ajax layout!), And if anything we can do to stop it?
source share