XF 2.3 Page cache not working for root URL "/" - 2 second TTFB while "/forums/" loads in 0.2s

zamparalar.net

New member
Licensed customer
XenForo Version: 2.3
PHP Version: 8.4
Server: Apache 2.4, MariaDB, Redis
CDN: Cloudflare (Free)
<span data-prose-review-ignore="">&nbsp;</span>
---
<span data-prose-review-ignore="">&nbsp;</span>
PROBLEM:
<span data-prose-review-ignore="">&nbsp;</span>
Root URL "/" takes ~2 seconds TTFB while "/forums/" loads in ~0.2 seconds.
<span data-prose-review-ignore="">&nbsp;</span>
Test results:
curl /forums/ → TTFB: 0.18s (pageCache working)
curl / → TTFB: 2.0s (pageCache NOT working)
<span data-prose-review-ignore="">&nbsp;</span>
---
<span data-prose-review-ignore="">&nbsp;</span>
INVESTIGATION FINDINGS:
<span data-prose-review-ignore="">&nbsp;</span>
1. Redis pageCache is configured and working — /forums/ is cached correctly
2. Root URL "/" always returns "cache-control: private, no-cache" and sets xf_csrf cookie
3. Because of CSRF token, XenForo refuses to cache the root URL
4. Response size: / = 468KB, /forums/ = 0 bytes (served from cache)
<span data-prose-review-ignore="">&nbsp;</span>
---
<span data-prose-review-ignore="">&nbsp;</span>
config.php:
<span data-prose-review-ignore="">&nbsp;</span>
$config['cache']['enabled'] = true;
$config['cache']['provider'] = 'Redis';
$config['cache']['config'] = [
'host' =&gt; 'localhost',
'port' =&gt; 6379,
'database' =&gt; 0
];
$config['pageCache']['enabled'] = true;
$config['pageCache']['lifetime'] = 300;
$config['pageCache']['excludedRoutes'] = [
'account/',
'login/',
'register/',
];
<span data-prose-review-ignore="">&nbsp;</span>
---
<span data-prose-review-ignore="">&nbsp;</span>
QUESTION:
<span data-prose-review-ignore="">&nbsp;</span>
Why does the root URL "/" always set a CSRF cookie and bypass pageCache, even for guests?
Is this expected behavior?
How can we make "/" cacheable?
<span data-prose-review-ignore="">&nbsp;</span>
Home page route is set to "forums/" in Admin Panel options.
When visiting seckinler.xyz, XenForo serves a 468KB page directly instead of redirecting.
The same content at /forums/ loads in 0.18s from cache.
 
Back
Top Bottom