Preventing Joomla! from sending no-cache in headers

P

If you are using Joomla! 1.5+ and trying to cache with nginx or other caching server and at same time you don’t want to use Joomla! system cache plugin. You’ll face a big problem, that Joomla! is sending “Cache-Control: no-cache” and “Pragma: no-cache” in response headers.

Here’s the solution :

1. Edit the following file :

Joomla root/libraries/joomla/environment/response.php

2. Search for the following code :

if (self::allowCache() === false) {
self::setHeader('Cache-Control', 'no-cache', false);
// HTTP 1.0
self::setHeader('Pragma', 'no-cache');
}

3. Comment this if condition, to be as follows

/*
if (self::allowCache() === false) {
self::setHeader('Cache-Control', 'no-cache', false);
// HTTP 1.0
self::setHeader('Pragma', 'no-cache');
}
*/

Now, you can disable Joomla! caching, and run whatever caching server, as nginx.

About the author

Mahmoud M. Abdel-Fattah

2 comments

 

WP-SpamFree by Pole Position Marketing

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Recent Posts

Recent Comments