1 Browser Caching Header
A good way to improve the performance (loading time) of your webpage is to tell the browser he should use cached files (css, js, images, …) instead of always loading the ressources from you webserver. The best way to make your web page faster is to minimize the number of files and size of files that must be downloaded when the page is loaded.
Gentics Portal.Node PHP supports caching headers for different filetypes out of the box and it’s your choice how long each filetype should be cached in browser.
2 How it works
If chaching headers are configured for a filetype (e.g. *.jpeg) then Gentics Portal.Node PHP sends a special Header to clients when they request the file. In this header a max life time is set.
Cache-Control:max-age=2678400, public Content-Type:image/jpeg Date:Fri, 10 Jan 2014 08:58:02 GMT Expires:Mon, 10 Feb 2014 09:58:02 +0100 Last-Modified:Wed, 08 Jan 2014 21:52:02 GMT Pragma:public
If a browser loads site and the file is actual (in this lifetime) he fetch the file directly out of his cache.
3 Configuration
The caching times are configured in main.php and can be overwritten in client_main.php
'modules' => array( 'contentSource' => array( //define browser cache-control max-age in seconds for each filetype individually 'staticFileCacheControl' => array( 'image/jpeg' => 60 * 60 * 24 * 31, 'image/png' => 60 * 60 * 24 * 31, 'image/gif' => 60 * 60 * 24 * 31, 'image/x-icon' => 60 * 60 * 24 * 7, 'image/svg+xml' => 60 * 60 * 24 * 7, 'text/css' => 60 * 60 * 2, 'application/javascript' => 60 * 60 * 2, 'application/x-javascript' => 60 * 60 * 2, 'text/html' => 0, ) ) )